LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

xml to Cluster/array

Hello All,

 

I have many things in xml file and i need to convert it into array of cluster so i caan use those values for my futher need. Can someone guide me on the same.

 

Thanks in advance.

 

pals

0 Kudos
Message 1 of 15
(7,658 Views)

What generated the XML? If you used flatten to XML on the cluster then it is easy.

 

Example_VI_BD.png

 

Otherwise you should take a look at the XML parsing examples that ship with LabVIEW.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 15
(7,651 Views)

Also you can try EasyXML from JKI.

=====================
LabVIEW 2012


0 Kudos
Message 3 of 15
(7,644 Views)

Hi,

Thanks but i cant use EasyXML. I have lots of different data and which i need to convert into Array so i can use in the loop one-by-one.

Thanks a lot.

0 Kudos
Message 4 of 15
(7,642 Views)

@Sim5 wrote:

Hi,

Thanks but i cant use EasyXML. I have lots of different data and which i need to convert into Array so i can use in the loop one-by-one.


That's a non-sequitor. Using EasyXML does not prevent you from doing that. What's important is what schema did you use. Steve asked what generated the XML file, but you never answered the question. If the file was generated from LabVIEW using the Flatten to XML function, then the LabVIEW schema would have been used. In this case, the Unflatten From XML will work quite well, as Steve's example shows. If you are using a custom schema then you need to read the XML file yourself and navigate the DOM based on the schema. You can choose to do this using the XML Parser functions in LabVIEW, or you can choose to use EasyXML. Examples on using the XML Parser functions ship with LabVIEW.

0 Kudos
Message 5 of 15
(7,634 Views)

Hi,

I already have xml file which i am trying to read using this code... But its not working....

Thanks!!!!!!

0 Kudos
Message 6 of 15
(7,623 Views)

And xml file is not created by Labview.

0 Kudos
Message 7 of 15
(7,620 Views)

Please read the documentation. The VIs you are trying to use only work with XML files that use the LabVIEW schema. Since your XML file does not use that schema, you cannot use those VIs. As I said, you have the following choices:

 

  • Use the XML Parser VIs. The XML Parser VIs are not the same as the XML VIs. The XML Parser VIs use the Xerces parser. I do not remember if these are available in LabVIEW 8.5.
  • Use EasyXML. This has already been mentioned, but you have not explained why you do not want to use it. Your assumption that you cannot use it is wrong.
  • Use LabXML. This uses the Microsoft XML parser. There is also a version that uses libXML.
  • Parse the file yourself.
0 Kudos
Message 8 of 15
(7,613 Views)

HI,

Easy lab is not there in 8.5.1 and Lab XML is another toolkit which i can't buy. I have to do this project using given things so i can't use both.

Is there any other way. If so and then i would be glad as i don't know much about xml in labview.

 

Thanks!!!!!

0 Kudos
Message 9 of 15
(7,602 Views)

I also don't know if the XML parsing functionality existed in 8.5. Do you have this in your pallette? If so go to help/find examples and look for Load Test Configuration.vi. That should get you started.

 

xml.png

=====================
LabVIEW 2012


0 Kudos
Message 10 of 15
(7,600 Views)