Using XML Data in LabVIEW Just Got Easier

Posted on Saturday 1 March 2008

As I've mentioned before, using XML data in LabVIEW is way too hard.  And, according to this poll, 7 out of 10 LabVIEW developers think so, too.  LabVIEW's built-in XML schema and support functions are not at all useful for generating and parsing XML schemas defined by others.  And, the various tools available to LabVIEW developers for generating and parsing XML schemas defined by others are not easy to use.

For example, there's really no simple and maintainable way to write the code necessary to generate and parse the following XML:

<Person Nationality=”US”>
  <Name>
    <First>John</First>
    <Last>Doe</Last>
  </Name>
</Person>

The existing tools require understanding way too much about the details of the XML language (e.g., DOM) and get in the way of the average developer doing useful work with XML data.  For examples, this is the code required to read only a single attribute of an XML entity:

DOM Example

When I think easy, I imagine a tool that will allow the developer to:

1.) define a simple LabVIEW data structure that is analogous to an XML data structure of interest and
2.) use it to generate and parse the XML data.

For example, generating and parsing XML data in LabVIEW should be as easy as creating a cluster:

cluster_to_xml.png

The good news is that JKI Software has just released such a tool that lets you work with XML by simply creating a cluster in LabVIEW.  For example, you can create an XML playlist with just one VI and a cluster, as show in the screenshot, below.

Playlist Generation Example

And, parsing XML is just as easy, as you can see in this example that downloads the LAVA RSS feed and parses the data into a cluster.

RSS Reader Example

This new tool is called the EasyXML Toolkit for LabVIEW and is a low-cost ($39 introductory price) toolkit that can be installed using VI Package Manager.  And, you can even download the demo for free, using VIPM.  Now, that's easy.

17 Comments for 'Using XML Data in LabVIEW Just Got Easier'

  1.  
    March 2, 2008 | 5:11 pm
     

    I prematurely hit the “publish” button, yesterday, when I released this blog article. The result was that the article sounded too much like a cheap ad and not enough like an informative article. So, today, I updated the article with some more useful information. Ya, this article is still a plug for EasyXML, but I hope you find it informative :)

  2.  
    Alex
    March 3, 2008 | 7:24 am
     

    Nice tool! Unfortunately I’m about to publish a clone of it for free ;)

  3.  
    March 3, 2008 | 8:20 am
     

    Alex: Don’t let us stop you :) But, please give our free demo a try. We’ve worked hard to make sure that EasyXML is very robust, full of many nice usability features (e.g., pretty-print, support for attributes, graceful handling of comments, etc.), and is of the high-quality you’d expect from commercial grade software. I happily take on the challenge of trying to win you as a customer :)

  4.  
    Alex
    March 3, 2008 | 9:14 am
     

    Do you manage attributes? Like this:

    [xml comments filtered out by blog]

  5.  
    March 3, 2008 | 9:24 am
     

    Alex: Yes, sorry, the blog does filter anything that might look like XML, since that might be a security issue when the HTML is rendered. You can read more about how attributes are handled in the documentation, here. Basically, attributes are achieved by placing a cluster named “#attributes” as the first cluster element of the xml element cluster.

  6.  
    Oskar
    March 4, 2008 | 1:13 pm
     

    Alex,
    Could you provide a link to your free toolkit? Curious about that one as well.

    Jim,
    Would it be possible (technically) to have the XML parser generate a cluster automatically. So that you can get that without, in advance, knowing what XML data you are getting. I guess that would be a variant then? Wonder how you would display that??

  7.  
    March 4, 2008 | 1:25 pm
     

    Oskar: We could, conceivably parse the XML data without knowing the LabVIEW data structure, in advance — yes, putting this in a variant would make sense. In a future version of the software, we are considering adding a utility that would allow you to create a cluster from the XML string, in order to reduce the work required to create a VI that can parse an XML string. We’ve got a lot of additional ease-of-use features that we’re working on, too :)

    Alex: I’m curious to see your tool, too.

  8.  
    Vincent
    March 6, 2008 | 12:49 am
     

    Its nice to know other people have the same needs and are working towards a more robust parser. I remember a year ago, I couldn’t find any discussions or code that could parse XML into a LabVIEW cluster. I actually spent some time developing my own vi to do just that. I’ve finally got it to a point where I think others could use it and improve upon it. However, I have no idea where I could share it.

  9.  
    Ton Plomp
    March 6, 2008 | 2:14 am
     

    On LAVA you can post such info at the CR in development portal.
    or as a new thread.

    Ton

  10.  
    March 6, 2008 | 10:31 am
     

    Vincent: As Ton mentioned, the LAVA Code Repository is a great place to share your code. But, if you don’t want to do something that formal, you can just post your code to the LAVA discussion forums for people to see.

  11.  
    Jon McBee
    May 16, 2008 | 12:56 pm
     

    What is the difference between the trial version of the software and the purchased version? I cant seem to find an online comparison of the two.

  12.  
    May 16, 2008 | 1:17 pm
     

    Jon: the trail version of EasyXML is full-featured, but will present a dialog, telling you that it is a demo version.

  13.  
    Eli
    May 29, 2008 | 1:00 pm
     

    Where did you find the first (orange) VI that converts the XML string into a DOM parser session? I can’t find it anywhere…

  14.  
    Ton Plomp
    May 29, 2008 | 1:35 pm
     

    I think it’s part of the Internet toolkit

    Ton

  15.  
    Eli
    May 29, 2008 | 8:04 pm
     

    I though it was too but I cannot find that specific one anywhere. I have all the other ones.

  16.  
    June 1, 2008 | 10:54 pm
     

    Eli: That’s a custom VI that I wrote. It’s part of what makes it hard to use XML in LabVIEW, I guess ;) Basically, it writes the string to a temp file and then uses the LabVIEW Internet Toolkit’s Read XML from File functionality to read the temp file, which is then deleted.

  17.  
    Eli
    June 2, 2008 | 3:02 pm
     

    Thank you Jim. Thats what I though was happening and exactly what I wanted to avoid.

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post |