-2

I'm creating a XML-file with VB.Net

I need to add the following element to the xml-file with XmlTextWriter:

<cbc:EndpointID schemeID="9925">VAT-number</cbc:EndpointID>

My code: Dim xtwWriter As New XmlTextWriter("Example_2.xml", Encoding.GetEncoding("UTF-8")) With xtwWriter .WriteStartDocument(True) .Formatting = Formatting.Indented ' Start the main element .WriteStartElement("Invoice") ' Correctly add the required attributes .WriteAttributeString("xmlns:qdt", "urn:oasis:names:specfication:ubl:schema:xsd:QualifiedDatatypes-2") .WriteAttributeString("xmlns:ccts", "urn:oasis:names:specfication:ubl:schema:xsd:CoreComponentParameters-2") .WriteAttributeString("xmlns:stat", "urn:oasis:names:specfication:ubl:schema:xsd:DocumentStatusCode-1.0") .WriteAttributeString("xmlns:cbc", "urn:oasis:names:specfication:ubl:schema:xsd:CommonBasicComponents-2") .WriteAttributeString("xmlns:cac", "urn:oasis:names:specfication:ubl:schema:xsd:CommonAggregateComponents-2") .WriteAttributeString("xmlns:udt", "urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2") .WriteAttributeString("xmlns", "urn:oasis:names:specfication:ubl:schema:xsd:Invoice-2") .WriteElementString("cbc:UBLVersionID", "2.0") .WriteElementString("cbc:CustomizationID", "1.0") .WriteElementString("cbc:ProfileID", "") .WriteElementString("cbc:ID", "Factuurnummer") .WriteElementString("cbc:IssueDate", "Factuurdatum") .WriteElementString("cbc:InvoiceTypeCode", "380=Factuur / 381=Kredietnota") .WriteElementString("cbc:DocumentCurrencyCode", "EUR") .WriteStartElement("cac:OrderReference") .WriteElementString("cbc:ID", "Ordernummer") .WriteEndElement() .WriteStartElement("cac:AccountSupplierParty") .WriteStartElement("cac:Party") .WriteStartElement("cac:PartyIdentification") .WriteStartElement("cbc:EndpointID")** .WriteAttributeString("schemeID", "9925") .WriteElementString("cbc:EndpointID", "BTW-nummer") .WriteEndElement()*** ...

New contributor
Peter R. is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.