LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does reading XML take so long?

Solved!
Go to solution

Bob_Schor wrote: However, if you don't "take a chance of making a fool of yourself", you are not likely to learn (as fast) from your mistakes!

I wholeheartedly agree.  Humility is not only a desirable quality, it empowers you to learn.

 

"Experience:  that most brutal of teachers.  But you learn, my God do you learn." C. S. Lewis

 

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 31 of 37
(4,039 Views)

I highly recommend using the LibXML libraries that Troy created in the previously linked article.  For large files, I'm seeing an over 500x speed improvement.

 

CLA, CTA
Not my tempo... AGAIN!
0 Kudos
Message 32 of 37
(4,013 Views)

I remember reading some XML files and having slow performance. It boiled down to String subset when extracting the tags (it was no XML vi's just string handling), so i shift registered the offset of last read and used the original string with different offsets instead of recreating the string. If was a BIG difference.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 33 of 37
(3,998 Views)

Here's our updated version of the LibXML LabVIEW wrappers that Troy posted.  They're updated for naming conventions, connectors, icons, a little documentation, and some additional wrappers have been created for functionailty in the LibXML DLL's that I needed for my particular applicaton.  There are surely many more functions that others might find useful.

CLA, CTA
Not my tempo... AGAIN!
Message 34 of 37
(3,978 Views)

Impressive difference, well done!

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 35 of 37
(3,954 Views)

Hi together,

 

I have the same problem parsing or generating XML with the NI.lib (DOMUserDefRef.dll). 
NI will not fix this issue in the near future, so I have to use Libxml2 or another toolkit.

 

Have you ever tried MS LINQ to XML ?
Documentation is here: https://docs.microsoft.com/en-us/dotnet/standard/linq/linq-xml-overview?

I tried this .Net Implemenation quickly and it looks also much better than the NI solution 🙂

 

So I´m not sure what is the best solution.

 

 

 

 

0 Kudos
Message 36 of 37
(1,670 Views)

@-Helmut- wrote:

Hi together,

 

I have the same problem parsing or generating XML with the NI.lib (DOMUserDefRef.dll). 
NI will not fix this issue in the near future, so I have to use Libxml2 or another toolkit.

 

Have you ever tried MS LINQ to XML ?
Documentation is here: https://docs.microsoft.com/en-us/dotnet/standard/linq/linq-xml-overview?

I tried this .Net Implemenation quickly and it looks also much better than the NI solution 🙂

 

So I´m not sure what is the best solution.

 

 

 

 


DOMUserDefRef.dll is published by the World Wide Web Consortium (W3C) and NI could not change it if they wanted too.  NI merely implements the dll exactly like every other platform does that uses eXtensible Mark-up Language to exchange data.  Since there are only so many lines on a data bus, DOMUserDefRef.dll has not been made threadsafe and each call is blocking.  

 

That is one factor you need to consider when choosing a file format.  XML is not the fastest but does have wide cross Platform applications since everything is in 1 dll.


"Should be" isn't "Is" -Jay
0 Kudos
Message 37 of 37
(1,633 Views)