Showing results for 
Search instead for 
Did you mean: 

Closing XML node that has been queried closes (crashes?) LabVIEW

Can someone confirm this observation with closing an XML node that has been searched with the XPath expression of "/" only?  This can be reproduced with the shipped XML example "Query XML Document for a Single".  Change the XPath expression to just the forward slash and notice that LabVIEW will close (or crash?) when the VI is executed.


0 Kudos
Message 1 of 5

It seems like LV is letting you 'slip one past the goalie' there.  I may be completely wrong, but I wouldn't expect '/' to be a valid XPath query and to simply error out.  The XPath to get the root element should be '/*', does that one crash it?


Are you sure that closing the node causes the crash, or do you try to get a node value or xml of the invalid node?  Closing seems like it should be a robust operation.


Hopefully I can test later, but since the parser is implemented via an external library, flaming crashes would not surprise me.

0 Kudos
Message 2 of 5

It doesn't crash until the origional node is closed.  In the example pic it is not unitl it reaches the last "close" does it crash.  I also gets a valid node from the search.  Also, the /* doesn't crash it but the Result XML is not the same.





I am attempting to teach myself some stuff on XML and XPath expressions and according to WC3:


/ selects the document root (which is always the parent of the document element)


Anyway, I don't ever plan on using / as a standalone search element but wasn't expecting the crash...


P.S. & FYI my overall purpose is to parse out data from XML files generated by TestStand.  I need to mine some data...

0 Kudos
Message 3 of 5

Ah, you are using LV10, now it is starting to come together.  A long time ago I convinced myself that Xerces was not happy with the '/' XPath query because in LV9 it crashes hard, and '/*' gave me what I was looking for.  Xerces considers the prolog a child of the root element, so in principle the query '/' should return the prolog plus the document element, and in LV10 it seems to do so.  Probably part of the W3C spec.  I tend to ignore the prolog, it usually has some annoying remote DTD that causes trouble.


The effect you see with the crash is probably related to something else that has bothered me.  For lack of a better term, the references in the DOM are not 'static'.  I once expected two XPath queries which gave the same node as a result to have the same refnums, but that is sadly not the case.  What seems to be happening now is that after the '/' query you have two refnums pointing to the same place, after you close the first one, apparently the second one is fatal.  A bit annoying, fortunately I am lazy about closing references except for the document itself.

0 Kudos
Message 4 of 5

Hi Paul,


I was able to recreate the behavior you're discussing. As you mentioned, it is unusual that LabVIEW simply crashes rather than throwing an error.


I am looking into this issue to check if it has previously been submitted as a Corrective Action Request.




NI Community Team
National Instruments
0 Kudos
Message 5 of 5