Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


default namespace xmlns

From: byggemandBob@-----------.---------.---
To: NULL
Date: 8/12/2008 5:38:00 AM

Hi I written some x++ code to export a xml file but I bumped into a small 
problem
my root node have 3 attributes and I add them like this.

    XMLDocOR = new XMLDocument();

    interchange = XMLDocOR.createElement("Interchange");
    XMLDocOR.appendChild(Interchange);
        att1 = XMLDocOR.createAttribute("xmlns");
        att1.nodeValue("http://...Omitted...");
        interchange.attributes().setNamedItem(att1);

        att2 = XMLDocOR.createAttribute("xmlns:xsi");
        att2.nodeValue("http://...omitted...");
        interchange.attributes().setNamedItem(att2);

        att3 = XMLDocOR.createAttribute("xsi:noNamespaceSchemaLocation");
        att3.nodeValue("EAN_Order_Response_Interchange_v1p11.xsd");
        interchange.attributes().setNamedItem(att3);

when I then want to add a new Node as a child to "Interchange" I add this code
    envelope = XMLDocOR.createElement("Envelope");
    interchange.appendChild(Envelope);

Now when I run this the exported file will look like this:

<?xml version="1.0" encoding="ISO-8859-1" ?> 
- <Interchange xmlns=".." xmlns:xsi=".." xsi:noNamespaceSchemaLocation="..">
  <Envelope xmlns="" /> 
  </Interchange>

Any idea why my "Envelope" inherits the first xmlns"" attribute? appending 
another child to Interchange will give it the same attribute appending a 
child to "envelope" will not give the new child a attribute. How do I add 
children to Interchange w/o getting the xmlns="" attribute?

(As this is proberly more something to do with xml than axapta I will try 
and ask here hope anyone can help me, for now I got a workaround by writing 
Xmlns insted of xmlns then it wont give all child nodes a empty namespace 
attribute)


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent