Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

xml - problem

$
0
0
hello,

i am using _xmldomwrapper and i have encountered a problem with my xml:

xml is:

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:edp="http://mydocs/Documents/Schemas/EDP-Common-1.xsd" xmlns="http://mydocs/Documents/Schemas/schema_8.xsd">
<table>
<att08>
</table>
</att08>



Now i want to insert child node to /envelope/table/att08

Now here is the poblem if i use code like this:
[ autoit ]      
#include<_XMLDomWrapper.au3> $origin_xml = @ScriptDir & "\" & "tax_2013.xml" $xml_open_origin = _XMLFileOpen($origin_xml,'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:edp="http://mydocs/Documents/Schemas/EDP-Common-1.xsd" xmlns="http://mydocs/Documents/Schemas/DOD_DDPO_8.xsd"') _XMLCreateChildNode("/Envelope/body/DOD_DDPO/Att08","TableA")

Node is not inserted because no node is selected ... xpath is wrong right?

Now with this code it "works" node gets selected and child is inserted:
[ autoit ]      
#include<_XMLDomWrapper.au3> $origin_xml = @ScriptDir & "\" & "tax_2013.xml" $xml_open_origin = _XMLFileOpen($origin_xml,'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:edp="http://mydocs/Documents/Schemas/EDP-Common-1.xsd" xmlns:test="http://mydocs/Documents/Schemas/DOD_DDPO_8.xsd"') _XMLCreateChildNode("/test:Envelope/test:body/test:DOD_DDPO/test:Att08","TableA")

But its inserted with attribute:
<TableA xmlns=""/>


Output should be:


 <?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:edp="http://mydocs/Documents/Schemas/EDP-Common-1.xsd" xmlns="http://mydocs/Documents/Schemas/schema_8.xsd">
<table>
<att08>
</TableA>
</table>
</att08>


can someone exqaplin to me whats wrong with my code?

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>