11-15-2012 04:04 AM - edited 11-15-2012 04:07 AM
HI,
I have below xml file, can any one please suggest how to read multiple roots and nested child tags.
Here "Main" is the root
Child1 and Child2 are subroots.
<?xml version="1.0"?>
-<Main>
<r1>104</r1>
<r2>DK99</r2>
-<Child1>
-<Child1_Branch1>
-<Branch1_row>
<r1>DATA HW</r1>
<r2>DATA SW</r2>
</Branch1_row>
</Child1_Branch1>
-<Child1_Branch2>
-<Branch2_row>
<r1>DATA HW</r1>
<r2>DATA SW</r2>
</Branch2_row>
</Child1_Branch2>
</Child1 >
-<Child2>
-<Child2_Branch1>
- <Branch1_row>
<r1>DATA HW</r1>
<r2>DATA SW</r2>
</Branch1_row>
</Child2_Branch1>
-<Child2_Branch2>
-<Branch2_row>
<r1>DATA HW</r1>
<r2>DATA SW</r2>
</Branch2_row>
</Child2_Branch2>
</Child2>
</Main>
11-15-2012 04:12 AM
Hello bsnayana,
are you aware of the XML instrument driver shipped with CVI? It permits reading / writing XML files and it could help you in handling your data.
You should have a XMLTree example on your machine that demintrates how to use the instrument to read an XML file and display its informations in a tree control.
11-15-2012 04:40 AM
Yes, I have but still i am not able to read the child tags inside each nested root (Child1 and Child2).
please suggest the function name which exactly points to the next root reference.
11-15-2012 05:56 AM
Well, I copied your text into a new .xml file and was able to view its content with XMLTree project, provided I deleted all hyphens preceding '<' start tag characters.
Exploring the code you should be able to see haw it addresses the elements in the file.
11-15-2012 06:12 AM
Didn't get what exactly XML tree. i am new to this XML reading stuff. can you please share your project file.
11-15-2012 07:09 AM
XMLTree is a public example which is loaded on your PC while installing CVI. You can locate it under <CVI example folder>\apps\xmltree folder.
Display the Welcome page and click on Explore examples... link, or launch the Example finder and search for XML: you should see listed this example together with <CVI example folder>\toolbox\XMLSample project.
11-16-2012 04:32 AM
Thanks.