frentzen Posted November 6, 2006 Report Share Posted November 6, 2006 Hi, i am new to LabView and i want to read data from a xml file and visualize it in a graph. has anybody a clou how this is possible? thanks a lot. regards, thomas Quote Link to comment
mross Posted November 6, 2006 Report Share Posted November 6, 2006 Hi,i am new to LabView and i want to read data from a xml file and visualize it in a graph. has anybody a clou how this is possible? thanks a lot. regards, thomas I don't know about canned LV functions for this, but isn't xml just text with a particular format? If that is the case then it is a matter of learning to use the string parsing functions, match pattern, scan from string, and so on. I would also look in to open G software, this is just the sort of thing that shows up as open source. Mike Quote Link to comment
LAVA 1.0 Content Posted November 6, 2006 Report Share Posted November 6, 2006 isn't xml just text with a particular format? It is "human readable" text, but the part that makes XML useful is the application of a schema. LabVIEW's XML functions use a LabVIEW schema to read and write data. If the data to be graphed is not originally from LabVIEW, your effort to read and process the XML goes up considerably. LabVIEW XML SchemaLabVIEW converts data to an established XML schema. Currently, you cannot create customized schemas, and you cannot control how LabVIEW tags each piece of data. Also, you cannot convert entire VIs or functions to XML. The predefined XML schema that LabVIEW uses is LVXMLSchema.xsd located in the labview\vi.lib\Utility directory. Quote Link to comment
Mike Ashe Posted November 6, 2006 Report Share Posted November 6, 2006 You can use the Microsoft XML Parser 4.0 as an ActiveX Automation control to read and parse the file for you. It takes a little bit of work, but you learn a lot in the process and end up with some usefull tools. The parser ships and installs with LabVIEW now. 1. Drop an Automation Ref control on your front panel 2. Select Microsoft XML 4.0 Class and IXMLDOMDocument2 object A. wire an Automation Open node to that and then into ... 3. Drop an invoke method on your diagram, wire to the Ref and select "load" as the method 4. xmlSource needs a variant of a path as input 5. next wire in a property node set to "childNodes" 6. Check for parse errors, then A. Property: length B. loop through the child nodes getting the item , nodetype, data, etc The rest you can work through yourself, have fun :thumbup: Okay, I'm about to go get my second cup of coffee, so I'll also point you to: Microsoft: Introduction to DOM - Document Object Model Which will give you a bit more guidance (and save me from having to answer a lot more of the initial questions). As you work through this remember that it is from the perspective of the text world, so in the "Working With DOM" subtopic you can search on "childNodes" and see the function for getting the nodes. The equivalent in LabVIEW is just the initial Reference wire with a property node (item 5 above). Etc, etc. Like I said, some work, but lets you use much more flexible tools and a much more compact and readable XML that with NI's built in stuff. YMMV Quote Link to comment
Randy Posted November 7, 2006 Report Share Posted November 7, 2006 Another example of access/manipulation of XML files can be seen at the attached link. Instead of creating ActiveX objects in Labview I'm utilizing external javascript to perform the load and insert functions through function calls. This eliminates the need for creation/cleanup of Labview methods/properties (since LV doesn't have garbage collection but Javascript does http://forums.lavag.org/index.php?showtopi...amp;#entry19380 Quote Link to comment
Mike Ashe Posted November 7, 2006 Report Share Posted November 7, 2006 Nice example Randy, thanks for sharing this! I can see good uses for this in reporting on tests. Quote Link to comment
Randy Posted November 7, 2006 Report Share Posted November 7, 2006 That's exactly what I'm using for currently, on my test equipment I'm writing results to a network database but needed a local storage in case the network was down. I've attached an example of the XML that I'm using to log our test results. Download File:post-3040-1162909966.xml Nice example Randy, thanks for sharing this!I can see good uses for this in reporting on tests. Quote Link to comment
Randy Posted December 5, 2006 Report Share Posted December 5, 2006 A better example one of my system's test results stored in an xml. Download File:post-3040-1165338503.xml That's exactly what I'm using for currently, on my test equipment I'm writing results to a network database but needed a local storage in case the network was down. I've attached an example of the XML that I'm using to log our test results.Download File:post-3040-1162909966.xml Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.