LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

EasyXML Reading XML file with children & different attributes

I'm very new to labview and XML, but I need to create a program to read an XML file, extract some data and do some manipulations. The XML file (sample attached) has 5 Config tables, each of which can contain an arbitrary number of ConfigRecords. Four out of the five tables have the same attribute format for the ConfigRecords, with the fifth having a different format. Eventually I want to read all records into an array, but Im trying to break down the problem and at least view each element in a string indicator first. 

 

Using EasyXML, I created a VI to create an XML file with the same format, thinking that I could then switch the "Write" to "Read" and read in all my data from existing files. I've gotten all the header info to work (shown in the attached) but I can't get anything to read from the "ConfigTables". I'd think that "ConfigTables" should be an array, but then I don't know how I'd handle the last table with the different attribute names. I've tried both ways and I still can't read the file, what else should I try? 

 

 

Download All
0 Kudos
Message 1 of 4
(3,418 Views)

Hmmm I will have to install the JKI Easy XML but on first look you might have  a problem with your XML file.

 

Now I am not XML expert but I use the free XML Notepad 2007 from Microsoft to create and edit XML files, and yours does not look right when I load it.

 

All of your Elements are being seen as Attributes so they all show up in red in the XML tree view. 

XMLCapture.PNG

 

I changed them all to Elements, give this a try

 

xmleCapture.PNG 

 

  

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 4
(3,387 Views)

The problem is this "XML" file is the output of a piece of software written by another company, even if its wrong, it may be something I have to deal with. Is it wrong that all of the items are attributes? Is there not a way all of the items and read their elements? Is there some sort of template or something that I can apply so that Labview reads the attributes as elements? 

0 Kudos
Message 3 of 4
(3,381 Views)

LIke I said I am not an XML expert but I think the problem lies in your XML file using DOM and the LabVIEW XML parser (probably the JKI too) is looking for a basic XML Tree format. 

 

Maybe there is a better XML parser that can handle the DOM format? I don't know...

 

I changed all of your attributes to elements using XML Notepad I linked to before. But looking at the raw output you are going to have to do more than that because you have duplicate paths in your tree now.

 

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 4
(3,373 Views)