Components

cancel
Showing results for 
Search instead for 
Did you mean: 

Reference Library for Converting Between LabVIEW and XML Data (GXML)

I think my approach to "un-concantination" was the search parser.  I can see this VI being useful however when you need to use the quick parser.

 

Thank you

 

Jeff Tipps - S&V Systems Engineer

0 Kudos
Message 61 of 132
(6,327 Views)

Jeff thank you for this work it is way way better than the default Unflatten From XML and Flatten To XML, looks very usable, it seems faster and generates smaller better readable XML files.

 

I applied a few patches and fixes to the 1.4.0 library, may be useful for others too. See attachment LabVIEW 2010, you can just put it somewhere in your project directory. Note strange things may happen if you have the GXML library installed with the official installer in parallel...

 

Timestamp issue, see message of mq17. Changes to be made:

In

  • gxml_RcrsvFlatten.vi
  • gxml_BlindXMLtoFlatString.vi
  • gxml_UnflattenAndScanItem.vi

replace time stamp format string

%<%H:%M:%S %x>T

with

%^<%Y-%m-%d %H:%M:%S%12u>T

 So the date format is now stored in UTC (time zone independent), no longer dependent of your local settings and has 12 digits precision so you can put nanosecond accurate time stamps in XML files (need that in my application). New time stamps look like "2012-06-26 18:02:23.625000000000" for today.

 

It is still not perfect, as far as I understand you cannot lossless convert the LabVIEW timestamp format to a string.

 

Also apply following change to

  • gxml_TimeCheck.vi

change regular expression

^\d?\d:\d?\d:\d?\d\s\d?\d/\d?\d/\d\d\d\d

 to

^\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{2}:\d{2}\.\d{12}

to match the new time format. 

 

 

Path data type issue.

If a Path occurs on the input data with value Not A Path, this is not converted to Not A Path on the output, instead to a valid path with path value  "<Not A Path>". This is a limitation of the String To Path primitive. Easy fix this by drawing a case structure around it, see snippets. You need to change this in

  • gxml_BlindXMLtoFlatString.vi
  • gxml_XMLtoFlatString.vi

.Better String To Path.pngBetter String To Path2.png

 

Decimal point issue, see post of mq17 too.

To get correct operation with different locals, always use the "." as decimal separator.

 

In

  • gxml_GetEnumTxt.vi
  • gxml_UnflattenAndScanItem.vi (twice)

change

%#g

to

%.;%g

 

 

Jeff, what about a version 1.4.1?

 

0 Kudos
Message 62 of 132
(6,294 Views)

Solved a bug in the quick parser. Compare the "Path" case in gxml_BlindXMLtoFlatString.vi to gxml_BlindXMLtoFlatString.vi. In gxml_BlindXMLtoFlatString.vi the call to the XML unescape VI gxml_UnescapeChar.vi is forgotten.

 

Example: without fixing, Quick Parser returns "&lt;Not A Path&gt;" instead of a real "<Not A Path>".gxml blindxml unescape.png

0 Kudos
Message 63 of 132
(6,276 Views)

Today, I ran into a little issue in combining GXML with the LabVIEW XML Parser.

 

The case: I'm storing fragments of GXML-generated XML in a larger XML file. This allows me to keep all sorts of settings together in one XML file, while still having the convenience of using GXML for parsing most of the XML. (If that's a silly thing to do, I'd be open for suggestions).

 

In any case, if you try to do this using a combination of GXML and LabVIEW's XML Parser, you will run into an issue. The Parser will automatically pretty-print GXML-generated code like this:

<MyString type='String'></MyString>

 and store it as:

<MyString type='String'/>

 If you now try to parse back the XML using GXML, GXML will give an error.

 

The attached "gxml_GetTagContents.vi" has been modified so GXML can deal with such short-form XML tags.

 

If you have any questions about this patch, feel free to contact me. Use at your own risk 🙂

 

Best regards,

 

 

Onno 

Science & Wires — a blog on LabVIEW and scientific programming
http://scienceandwires.com
0 Kudos
Message 64 of 132
(6,242 Views)

Hi Onno,

 

I tried unsuccessfully to remove your GXML.lvlib dependency (even selected Remove when prompted).  Would you mind posting an unmangled version of your  gxml_GetTagContents.vi?


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 65 of 132
(6,153 Views)

Hi LabBEAN,

 

Does the attached version solve the issue?

 

Best,

 

 

Onno

Science & Wires — a blog on LabVIEW and scientific programming
http://scienceandwires.com
0 Kudos
Message 66 of 132
(6,125 Views)

Yes, thank you Onno.  Aside:  It would be great if NI would update the official version for some of the bug fixes / additions / suggestions here and port the Windows installer to a VIP.


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
Message 67 of 132
(6,116 Views)

Hi !

For my Win development I'm currently using LV funtions  'Un/Flatten to XML' (that can be found on the palette File IO -> XML -> LV Schema).

It really looks like it does the same job than GXML library.

 

What are the difference between GXML and 'Un/Flatten to XML' functions ? Is GXML better on RT targets?

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 68 of 132
(6,019 Views)

The native LabVIEW XML functions are significantly faster than GXML.  That is its main advantage however it is not officially tested or supported in RT.  I know it has been used succesfully in some applications but it is not supported or even shown on the RT palette.

 

GXML supports versioning (which allows you to mutate older files to newer type defs) and it is supported in RT.  The serach parser can be pretty slow but the quick parser can unflatten very large and complex files in under a second.  It also has other differences like the ability to concatinate multiple type defs into one file and it is significantly more terse.  GXML has one tag per data item while the LabVIEW function has many tags per data item.

 

Jeff Tipps

S&V Systems Engineer

Message 69 of 132
(6,007 Views)

I tried twice, dwonloading and installing in Windows 7, but each time, Windows Explorer crashed when I tried to run the installer, Setup.exe.

 

This is a bit of a problem.  Would appreciate any help.

 

Mark

0 Kudos
Message 70 of 132
(5,951 Views)