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

Read XML

Explorer ,
Feb 10, 2020 Feb 10, 2020

How to read the attribute values in the below xml file.  

 

<List>
<p name="DZPNumber" replacement="PN"/>
<p name="DZPTitle" replacement="PT"/>

</List>

 

var myXMLFile = File("/WorkSpace//Collection.xml")

myXMLFile.open('r');

var allElements = new XML(myXMLFile.read());

myXMLFile.close();

var nodes = allElements[0].xpath("//p");

for(var i = 0; i < nodes.length(); i++){

      $.writeln (nodes[i])

}

TOPICS
Scripting
1.4K
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

correct answers 1 Correct answer

Community Expert , Feb 10, 2020 Feb 10, 2020

Use the @notation like follows

nodes[i].@name

 

-Manan

Translate
Community Expert ,
Feb 10, 2020 Feb 10, 2020
LATEST

Use the @notation like follows

nodes[i].@name

 

-Manan

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