Jump to content

XML Representation


Matt C

Recommended Posts

Hello,

I have a data format that I'm having trouble representing in LabVIEW as a format that the EasyXML tool can translate. I think it's impossible, but I wanted to make sure before I gave up. Essentially, an array of data has to be represented in a format where each array value is represented as an attribute of a RAW tag. Please see the attached files. Thanks in advance for your help.

MeasurementExample.xml

post-2653-1236352827_thumb.jpg

Link to comment
Share on other sites

Hi Matt,

 

Here's the solution, below.

 

Note that your XML was not valid, as there must be only one root-level element. To fix this, I wrapped "MeasurementX" and "MeasurementY" in an element named "Root" ().

 

MeasurementExample.vi

 

1.png

 

Please let me know if you have any more questions. I'm happy to help. Also, there's some detailed documentation located, here, although sometimes it's a little tricky to see how every XML structure maps into EasyXML's LabVIEW structures.

 

-Jim

Link to comment
Share on other sites

Jim,

 

When I just reverse the code you sent to just create an xml string, the result is incorrect.

 

Hi Matt,

 

I'm not sure what you are seeing that makes you think that the result is not correct. When I run the example you sent me, with data populated in the arrays, I get:

 

 

MeasurementExample_Reversed_JK01.vi

 

MeasurementExample_Reversed_JK01.png

 

In order for me to be able help better, can you tell me what are you seeing vs. what you expected to see?

 

Thanks,

 

-Jim

Link to comment
Share on other sites

Jim,

 

The trouble is with the RAW tags. The output format should be

 

<MeasureX>

<RAW VALUE="0.02">

</RAW>

<RAW VALUE="2.1000000000000001E-2">

</RAW>

</MeasureX>

 

but comes out as

 

<MeasureX>

<RAW VALUE="1"/>

<RAW VALUE="2"/>

</MeasureX>

Link to comment
Share on other sites

The trouble is with the RAW tags. The output format should be

 

<MeasureX>

<RAW VALUE="0.02">

</RAW>

<RAW VALUE="2.1000000000000001E-2">

</RAW>

</MeasureX>

 

but comes out as

 

<MeasureX>

<RAW VALUE="1"/>

<RAW VALUE="2"/>

</MeasureX>

 

The two XML structures are equivalent for empty content data (which can support attributes). Here is a link on Wikipedia:

http://en.wikipedia.org/wiki/XML

 

Search for the following text:

XML provides special syntax for representing an element with empty content. Instead of writing a start-tag followed immediately by an end-tag, a document may contain an empty-element tag. An empty-element tag resembles a start-tag but contains a slash just before the closing angle bracket. The following three examples are equivalent in XML:

 

I know there are more formal references for XML but in this case the Wikipedia page is much easier to read and understand.

 

Omar

Link to comment
Share on other sites

Jim,

 

The trouble is with the RAW tags. The output format should be

 

 

but comes out as

 

 

 

Hi Matt,

 

Are you concerned about the difference between the empty elements "" and "" or the difference in the numeric precision of the "VALUE" attributes?

 

Thanks,

 

-Jim

Link to comment
Share on other sites

Hi Matt,

 

Are you concerned about the difference between the empty elements "<RAW></Raw>" and "<RAW/>" or the difference in the numeric precision of the "VALUE" attributes?

 

Thanks,

 

-Jim

 

 

Jim, I was looking at the "<RAW></Raw>" and "<RAW/>" difference. But assuming that they are equivalent when parsed by a DOM parser, I guess that this isn't really an issue then. Thanks for the help Jim and Omar.

Link to comment
Share on other sites

Jim, I was looking at the "" and "" difference. But assuming that they are equivalent when parsed by a DOM parser, I guess that this isn't really an issue then. Thanks for the help Jim and Omar.

 

Yes, "" and "" are equivalent. DOM parsers and EasyXML should have no trouble with either format.

Link to comment
Share on other sites

I've just run into another potential problem. My xml structure has attributes which have colon's (:) in the name. The rest of the items in my cluster load fine, but those with the colon do not load. Unfortunately, I don't define the xml structure so I have to just try to make it work. Help please!

Link to comment
Share on other sites

I've just run into another potential problem. My xml structure has attributes which have colon's (:) in the name. The rest of the items in my cluster load fine, but those with the colon do not load. Unfortunately, I don't define the xml structure so I have to just try to make it work. Help please!

 

Hi Matt,

 

We've fixed this issue. I'll send you an email with details.

 

Thanks,

 

-Jim

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.