Jump to content

Identify empty elements from Easy Parse XML


fab

Recommended Posts

I am using EasyXML for the first time and I love it.

 

One problem I have is that the XML messages I will be getting might not have every single element in the XML schema. I was hoping that the output of the "Easy Parse XML" would return my default values for the empty elements as opposed to returning the LabVIEW Defaults for the empty elements.

 

So in the example below, I would get for the vehicle OUT: ver =2010, pitch=-91, roll=-91.

 

Is there a way to identify the empty elements?

 

post-2936-1288215635.png post-2936-1288215639.png

Link to comment
Share on other sites

This is the work around I plan to use:

 

post-2936-1288219537_thumb.png

 

Please let me know if there is a better way or a feature that I don't know about in Easy XML.

 

If this is not present in Easy XML, it would be nice for a future version to have a boolean to set if the output cluster should "use LabVIEW defaults for empty elements" or "use values wired to the 'LabVIEW Data (Type)' input".

 

Thanks,

Fab

Link to comment
Share on other sites

I had to modify my workaround so it would work as a subVI.

 

I added a "hack" to make sure the output would be updated with the latest value. (Note that I did not do a snippet this time, because it messed up the references and now it wanted to add a property node for the local variable.)

 

post-2936-1288229503_thumb.png

 

Find attached the VI.

EmptyElementEasyParseXML_workaround.vi

 

Any help on making this easier/better would be much appreciated.

 

Thanks,

Fab

Link to comment
Share on other sites

Hi Fab,

 

I'm happy to hear that you love EasyXML :)

 

An option to use the input data type as the default values for the output sounds like a great feature addition, to me. We'll certainly add this to the list of feature ideas for a future release (and, I've heard this suggestion at least once or twice from other people). I've filed an official feature suggestion, in our tracker:

  • Case 10191: Need an option to use the input data type as the default values for "Easy Parse XML"

Regarding your solution (it's great, BTW!), I would probably use variant manipulation instead of control references, since control references requires the front panel to be loaded into memory and can cause some complications during the application build process and also can cause some performance issues. However, doing that requires recursion, which is a bit more complicated :)

 

Cheers!

 

-Jim

Link to comment
Share on other sites

An option to use the input data type as the default values for the output sounds like a great feature addition, to me. We'll certainly add this to the list of feature ideas for a future release (and, I've heard this suggestion at least once or twice from other people). I've filed an official feature suggestion, in our tracker:Case 10191: Need an option to use the input data type as the default values for "Easy Parse XML"

 

Thanks! That will be great. How can I find out when this gets implemented?

 

Regarding your solution (it's great, BTW!), I would probably use variant manipulation instead of control references, since control references requires the front panel to be loaded into memory and can cause some complications during the application build process and also can cause some performance issues. However, doing that requires recursion, which is a bit more complicated :)

 

Jim,

You got me thinking. One of the systems we are going to implement this on uses LabVIEW Real Time. I don't have the Real Time system here right now to test, but I have a feeling my workaround won't work there. What do you think?

 

When you mention "variant manipulation" are you referring to the OpenG VIs that give out the type descriptors inside the variant?

 

Thanks,

Fab

 

PS: I like the new forum theme :)

Link to comment
Share on other sites

Thanks! That will be great. How can I find out when this gets implemented?

 

We include a list of fixed issues and new features in the release notes of new versions. Also, you can feel free to inquire about the status and we'll let you know.

 

 

You got me thinking. One of the systems we are going to implement this on uses LabVIEW Real Time. I don't have the Real Time system here right now to test, but I have a feeling my workaround won't work there. What do you think?

 

I'm pretty sure (but not 100% positive) that your work-around, using control references, won't work. The VIs will probably still have their front panels, but I think that they won't be loaded into memory and you'll get an error.

 

 

When you mention "variant manipulation" are you referring to the OpenG VIs that give out the type descriptors inside the variant?

 

Yep, that's exactly what I meant: the OpenG LabVIEW Data Tools library (oglib_lvdata package). These are the VIs that we use, under the hood of EasyXML, to manipulate the LabVIEW data as a variant.

 

PS: I like the new forum theme :)

 

I noticed :) Thanks for the feedback.

 

-Jim

Link to comment
Share on other sites

I'm pretty sure (but not 100% positive) that your work-around, using control references, won't work. The VIs will probably still have their front panels, but I think that they won't be loaded into memory and you'll get an error.

 

Jim,

Unfortunately we were right :) I was able to test this code in a cRIO and I get error 53 coming out of the "To More Specific Class"...

 

So, either I will have to dive into the variant manipulation or I will write a less generic code that works only with my XML Schema. Given the amount of time I have for this project, unfortunately, I will have to go with the less elegant option. :)

 

Thanks again for the help and I will be anxiously waiting for the new release of EasyXML with default values :)

 

Thanks,

Fab

Link to comment
Share on other sites

Jim,

Unfortunately we were right :) I was able to test this code in a cRIO and I get error 53 coming out of the "To More Specific Class"...

 

So, either I will have to dive into the variant manipulation or I will write a less generic code that works only with my XML Schema. Given the amount of time I have for this project, unfortunately, I will have to go with the less elegant option. :)

 

Thanks again for the help and I will be anxiously waiting for the new release of EasyXML with default values :)

 

Thanks,

Fab

 

 

Thanks for the update. Let me know if you have any questions or issues with the variant manipulation. My guess is that I have about as much experience with this as anyone on the planet cool.gif

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.