Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Print xml contents

Community Beginner ,
Aug 07, 2017 Aug 07, 2017

hai,

I am using javascript for printing xml contents. I can able to get xml file but i don't know how to print xml contents pls any one guide me.

The following code i can tried,

var myFile=File.openDialog("Choose Xml File","*.xml");

myFile.open("r");

var mycontent = myFile.read();

myFile.close(); 

myxml = XML(mycontent);

var myxpath=myxml.xpath("//book[1]")

var myValue=myxpath.attributes()

var myContents=xml_Contents(myxpath,myValue);

alert(myContents)

       

       

function xml_Contents(mxl,mycnt)

{

    var myCont=[];

    try

    {

        var myxm=XML(mxl);

        if(myxm.contains(mycnt)==true)

        {

            myxm.descendants();

       return myCont;

        }

        else

        {

        return null;

        }

    }

    catch(e)

    {

        alert(e);

    }

}

Thanks,

Sangeetha.K

TOPICS
Scripting
419
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 07, 2017 Aug 07, 2017

InDesign cannot "print xml". You need to place it into an InDesign document first, and then print this instead.

If you want to manipulate "pure" XML (including printing it), you may be better off with using other software.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2017 Aug 08, 2017
LATEST

use this tool to test xml print https//jsonformatter.org/xml-pretty-print

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines