Hi there
I have a small problem with my namespaces:
I would like to end up with this xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Invoice xmlns="http://rep.oio.dk/ubl/xml/schemas/0p71/pip/"
xmlns:com="http://rep.oio.dk/ubl/xml/schemas/0p71/common/"
xmlns:main="http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rep.oio.dk/ubl/xml/schemas/0p71/pip/
http://rep.oio.dk/ubl/xml/schemas/0p71/pip/piplax.xsd">
<com:ID></com:ID>
<com:IssueDate></com:IssueDate>
<com:TypeCode></com:TypeCode>
<main:InvoiceCurrencyCode>
<com:BuyersReferenceID schemeID="EAN"></com:BuyersReferenceID>
<com:ReferencedOrder>
<com:BuyersOrderID></com:BuyersOrderID>
<com:IssueDate></com:IssueDate>
</com:ReferencedOrder>
<com:BuyerParty>
<com:ID schemeID="EAN"></com:ID>
<com:PartyName>
<com:Name></com:Name>
</com:PartyName>
<com:Address>
<com:ID></com:ID>
<com:Street></com:Street>
<com:HouseNumber></com:HouseNumber>
<com:CityName></com:CityName>
<com:PostalZone></com:PostalZone>
<com:Country>
<com:Code></com:Code>
</com:Country>
</com:Address>
<com:BuyerContact>
<com:ID></com:ID>
</com:BuyerContact>
</com:BuyerParty>
</Invoice>
But I end up with this
(i have substituttet my namespaces with "test" otherwise the document
gets so long)
<?xml version="1.0" encoding="iso-8859-1"?>
<Invoice xmlns="test">
<com:ID xmlns:com="test">2000</com:ID>
<com:IssueDate xmlns:com="test">200500001</com:IssueDate>
<com:TypeCode xmlns:com="test">PIE</com:TypeCode>
<main:InvoiceCurrencyCode
xmlns:main="test">DKK</main:InvoiceCurrencyCode>
<com:BuyersReferenceID com:schemeID="EAN"
xmlns:com="test">10000000</com:BuyersReferenceID>
<com:ReferencedOrder xmlns:com="test">
<com:BuyersOrderID>039090</com:BuyersOrderID>
<com:IssueDate>2005-02-14</com:IssueDate>
</com:ReferencedOrder>
<com:BuyerParty xmlns:com="test">
<com:ID com:schemeID="EAN">28147317</com:ID>
<com:PartyName>
<com:Name>JG Company</com:Name>
</com:PartyName>
<com:BuyerContact>
<com:ID>te**@test.com</com:ID>
<com:ID>te***@test.com</com:ID>
</com:BuyerContact>
</com:BuyerParty>
<com:SellerParty xmlns:com="test">
<com:ID com:schemeID="CVR">23568978</com:ID>
<com:PartyName>
<com:Name>Bygma</com:Name>
</com:PartyName>
<com:Address>
<com:ID>Vareafsendelse</com:ID>
<com:Street>Hovedgaden</com:Street>
<com:HouseNumber>30</com:HouseNumber>
<com:CityName>Copenhagen</com:CityName>
<com:PostalZone>3000</com:PostalZone>
</com:Address>
<com:PartyTaxScheme>
<com:CompanyTaxID com:schemeID="CVR">23568978</com:CompanyTaxID>
</com:PartyTaxScheme>
</com:SellerParty>
</Invoice>
I start my document like this:
XmlDocument doc = new XmlDocument();
XmlDeclaration decl = doc.CreateXmlDeclaration("1.0", "iso-8859-1",
null);
XmlElement root = doc.DocumentElement;
doc.InsertBefore(decl, root);
XmlElement HeadElement = doc.CreateElement(null, "Invoice", "test");
doc.AppendChild(HeadElement);
And continue to add elements like this:
//<com:Address>
XmlElement node_addr = doc.CreateElement("com", "Address", "test");
//<com:ID>Vareafsendelse</com:ID>
XmlElement e_addr_id = doc.CreateElement("com", "ID", "test");
Can anyone help to solve this ? :-)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!