06-11-2018 01:02 PM
I have seen this discussion, and the methodology doesn't seem to translate: https://forums.ni.com/t5/LabVIEW/XML-Attribute/td-p/791406
I'd like to set the attributes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" and xsi:schemaLocation="/path/to/schema" in the root node. The original XML is here:
<?xml version="1.0" encoding="utf-8"?> <root xmlns="http://example.com/XMLSchema/schema.xsd"> <child/> </root>
The desired XML is here:
<?xml version="1.0" encoding="utf-8"?> <root xmlns="http://example.com/XMLSchema/schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="C:\path\to\schema http://example.com/XMLSchema/schema.xsd"> <child/> </root>
My attempt (one of many, definitely wrong) is here:
Solved! Go to Solution.
06-11-2018 01:36 PM - edited 06-11-2018 01:47 PM
Instead of trying to add or replace nodes, you can simply get the document from the "updated" node.
There is an errata here. The order of the xsi:schemaLocation value should be namespace, path, NOT path,namespace as the snippet shows. I've updated it in my code, but it's minor enough that I'll be keeping it in this post.