LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get XML String Without the Declaration

Solved!
Go to solution

Is it possible to get the XML string from a DOM reference without the "<?xml ... ?>" node at the beginning? I'm having to manually remove the XML declaration using a Match Pattern function, which seems tedious and unnecessary. I'm guessing there is no way to do this, as the parser just does what it does. But perhaps there is a DOM property for this?

 

The attached example implements the following test code:

xml string test BD.png

 

 

And gives the following result:

xml string test FP.png

 

 

You can see that the intermediate result contains the XML declaration, which I then manually remove to get the output string equal to the input string.

 

Curiously, when you use Flatten to XML, the string does not contain the XML declaration.

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Message 1 of 4
(2,666 Views)
Solution
Accepted by topic author rwunderl

Not entirely sure. but maybe like this?

 

XML no declaration.png

 

Do close the document ref though.

Message 2 of 4
(2,651 Views)

Use the 1st Child property. 😉

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

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 4
(2,645 Views)

Works like a champ!

xml string test 2 BD.png

 

Not immediately intuitive, but the solution is at least plainly within the XML API.

 

Thanks for the quick fix.

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
Message 4 of 4
(2,589 Views)