access xml-nodes from xml file

arthurf48713214

07-05-2018

Hello,

how can i access a node of a xml-file

looks like this:

<RootNode>

     <EntryNode>

          <ColumnA>Some Value A</ColumnA>

          <ColumnB>Some Value B</ColumnB>

     </EntryNode>

     <EntryNode>

          <ColumnA>Some Value C</ColumnA>

          <ColumnB>Some Value D</ColumnB>

     </EntryNode>

</RootNode>

thanks for your help

Accepted Solutions (1)

Accepted Solutions (1)

_Bruce_Robertson

MVP

08-05-2018

Hi,

I'm guessing you mean reference it in JavaScript code rather than binding a field to it and using the rawValue?

In JavaScript $data is a reference to the Data DOM, so

$data.resolveNode('RootNode')                                                                 // refers to your root node
$data.resolveNodes('RootNode.EntryNode[*]').length                               // returns 2
$data.resolveNodes('RootNode.EntryNode[*].ColumnA').item(1).value    // returns "Some Value C"

Bruce

Answers (3)

Answers (3)

_Bruce_Robertson

MVP

08-05-2018

Do you have some fields bound to EntryNode or ColumnA, etc.  If so and they have a min occurs of 1 then an EntryNode will be created in the Data DOM.

arthurf48713214

08-05-2018

Thanks so much bruce.

I have another problem.

<RootNode>

     <EntryNode>

          <ColumnA>Some Value A</ColumnA>

          <ColumnB>Some Value B</ColumnB>

     </EntryNode>

</RootNode>

$data.resolveNodes('RootNode.EntryNode[*]').length                               // it returns 1

<RootNode>

</RootNode>

$data.resolveNodes('RootNode.EntryNode[*]').length                               // it returns 1  why not 0

Arthur