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

Read XML

Explorer ,
Feb 10, 2020 Feb 10, 2020

Copy link to clipboard

Copied

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

Views

1.3K

Translate

Translate

Report

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

Votes

Translate

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

Copy link to clipboard

Copied

LATEST

Use the @notation like follows

nodes[i].@name

 

-Manan

Votes

Translate

Translate

Report

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