LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

too many nodes returned from child nodes array property

Hello.

 

I've got some problems with extracting an array of elements (nodes) from a non-labview XML file. It does return an array containing the right elements, but I also get a lot of dummy-elements, which contains no data at all.

 

If I extract all the child nodes of an element by using the 'ChildNodesArray' property on an element which have got n child nodes, I ought to get an n-length array. Instead I get a (n*2)+1-length array, where the first and then every other element is an empty Text_Node and the interleaved elements are Element_Nodes containing the data of the actual child nodes. So for a node with 3 children it ends up something like this:

 

<node>

    <child>value1</child>

    <nextchild>value2</nextchild>

    <nextchild>value3</nextchild>

</node>

 

is converted to the array:

 

[0] Text_Node - no value

[1] Element_Node - value1

[2] Text_Node - no value

[3] Element_Node - value2

[4] Text_Node - no value

[5] Element_Node - value3

[6] Text_Node - no value

 

The values are then available by using the 'Get Node Text Content VI" function on the correct elements. To open the XML file in the first place I use the Load File Method.

 

It all seems rather unnecessary.

0 Kudos
Message 1 of 2
(2,363 Views)

Hi!

The fake text nodes you see are probably due to end of line characters.

 

Try this:

 

XMLNodesTest.png

removing all end of line characters you get only the 3 nodes you are looking for.

 

Regards,

Marco

Message 2 of 2
(2,333 Views)