I am getting this error when validating my xml data:
'The Invoice element has an invalid child DocumentCurrencyCode element in namespace urn: oasis: names: specification: ubl: schema: xsd: CommonBasicComponents-2.
List of possible expected elements: Note in namespace urn: oasis: names: specification: ubl: schema: xsd: CommonBasicComponents-2.'
This is the element in my xml:
<DocumentCurrencyCode xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">EUR</DocumentCurrencyCode>
These are my XML schema's:
<?xml version="1.0" encoding="utf-8"?><!-- Created with Liquid Technologies Online Tools 1.0 (https://www.liquid-technologies.com) --><xs:schema xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:oasis:names:specification:ubl:schema:xsd:Invoice" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:import schemaLocation="schema1.xsd" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" /><xs:import schemaLocation="schema2.xsd" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" /><xs:element name="Invoice"><xs:complexType><xs:sequence><xs:element ref="cbc:CustomizationID" /><xs:element ref="cbc:ProfileID" /><xs:element ref="cbc:ID" /><xs:element ref="cbc:IssueDate" /><xs:element ref="cbc:DueDate" /><xs:element ref="cbc:InvoiceTypeCode" /><xs:element ref="cbc:Note" /><xs:element ref="cbc:DocumentCurrencyCode" /><xs:element maxOccurs="unbounded" ref="cac:InvoiceLine" /></xs:sequence></xs:complexType></xs:element></xs:schema>
<?xml version="1.0" encoding="utf-8"?><!-- Created with Liquid Technologies Online Tools 1.0 (https://www.liquid-technologies.com) --><xs:schema xmlns:tns="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="CustomizationID" type="xs:string" /><xs:element name="ProfileID" type="xs:string" /><xs:element name="ID" type="xs:string" /><xs:element name="IssueDate" type="xs:date" /><xs:element name="DueDate" type="xs:date" /><xs:element name="InvoiceTypeCode" type="xs:unsignedShort" /><xs:element name="Note" type="xs:string" /><xs:element name="DocumentCurrencyCode" type="xs:string" /></xs:schema>
In my Invoice class looks the DocumentCurrencyCode like this:
/// <remarks/> [System.Xml.Serialization.XmlElementAttribute(Namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")] public string DocumentCurrencyCode { get { return this.documentCurrencyCodeField; } set { this.documentCurrencyCodeField = value; } }
Can someone tell me please what is wrong here?
Thank you!