![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: default namespace xmlns default namespace xmlnsTo: 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)
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
