Showing results for 
Search instead for 
Did you mean: 

Read from XML with proprietary schema

I would like to read from my own XML file with my proprietary schema. Is there any example where I can just specify the schema and load the .xml file and it recognizes the parameters? The idea is to be able to edit the elements of this .xml file and then create a new output file including a new MD5 checksum at the end (the cecksum part I already figured out).
0 Kudos
Message 1 of 8
You can try LabXML, which is free.
0 Kudos
Message 2 of 8
I have tried LabXML and I cannot find out how to do what I asked or at least not that I could understand easily how.... My schema is a .xsd file. Will I have to parse all the data by hand??
0 Kudos
Message 3 of 8
Are you referring to the validation of the XML file? If so, the "MSXML Validate" VI should do this for you. If that's not what you're talking about then I guess I must be misunderstanding what you're trying to do.
0 Kudos
Message 4 of 8
Sorry, maybe I was not very clear in m explanation of what I want to do.

I want to use my own xsd file that defines the structure of my xml file and pass it to labview so that it can recognize any of the xml files structured as defined by my xsd. Then when I read from one of my xml files I can select any element individually and edit them individually and finally rewrite the xml file with the new elements altered.

Hope this was clear and thanks for the help 🙂
0 Kudos
Message 5 of 8
It seems like you're asking two different questions. The first is that you want LabVIEW to "recognize any of the xml files structured as defined by my xsd". That sounds like a validation operation to me, and as I said, the "MSXML Validate" VI will do that. The second question seems to have a hidden requirement. You want to be able to select any element individually and edit them and finally write out the new XML file. Well, at face value the functions "MSXML select nodes in document", "MSXML Edit XML", and "MSXML save XML" will do all that for you. However, I suspect you're really asking that when you edit a node you validate against the schema. If that's the case I honestly don't know if the MS-based LabXML library is capable of that.

By the way, I'm assuming you were looking at the MSXML library, which is based on the Microsoft XML Parser, as opposed to the libXML library. All of my comments relate to the MSXML library.
0 Kudos
Message 6 of 8
They have in that package an example called "XML-example15.llb" inside this library there is a vi called "Database". It reads from an example xml and xsd and it even outputs an html according to a definition. This would be more or less what I want to do but I cannot firure out how to change the xsd that they are using and make the program recognize my own xml file.... I confess I am a rookie in XML so sorry if the questions are pretty basic.
0 Kudos
Message 7 of 8
No, your question is fine, but a more exact solution can't really be provided without having an XML file and an XSD file to look at.

In the example that ships with the MSXML library the HTML is being generated using an XML stylesheet, which has an .xsl extension. An XSL file and an XSD file are two different beasts. The XSD file is used for validation, while the XSL is used for output. In the example if you change, for example, the XML file to say, change the name of one of the tags in one of the records, and set the "Validate and show errors when loading" boolean on the front panel of the example VI and reload the XML you will get an error telling you the XML file is malformed. This is just coming from the "MSXML Validate XML" VI.

If you're having problems creating an XSD file perhaphs looking online at some XSD sites might help: google search.
0 Kudos
Message 8 of 8