Understanding XSD in Inbound E-Document Templates
The XSD file or XML Schema is a text file that defines and validates what XML elements and attributes must be present in the received XML, before it is uploaded as an inbound e-document record. After the received XML file is validated, the system assigns an e-document template to it. The first matched e-document template will be assigned to the newly created inbound e-document.
The following is a sample XSD that you can use as a reference in creating your own XSD file:
<xs:element name="edoc" type="edocType"/>
<xs:complexType name="edocType">
<xs:sequence>
<xs:element name="tranid" type="xs:string"/>
<xs:element name="po" type="xs:integer"/>
<xs:element name="memo" type="xs:string"/>
<xs:any processContents="skip" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="version" type="xs:string" use="required" fixed="1.1"/>
</xs:complexType>
</xs:schema>
This sample XSD validates an XML document for the following:
-
The root element is
edoc
is present, which must have an attributeversion
, with a value of1.1
. -
The
edoc
element must havetranid
,po
, andmemo
elements in the correct order, where:-
tranid
is a string -
po
is an integer -
memo
is a string
-
If this sample XSD is used, a received XML file must contain all the elements and attributes defined in the XSD. If it does, the E-Document Template record that the XSD is a part of, will be applied to the received XML file, which is then uploaded as an inbound e-document record. Other elements and attributes can be present in the received XML file in addition to the required ones defined in the XSD. You can define your own required elements and attributes in the XSD file you will create.
Related Topics
- Creating E-Document Templates
- XPath and Regex Examples for E-Document Templates
- PEPPOL Template
- Understanding Inbound E-Document Templates in JSON Format
- Understanding XSD in Outbound E-Document Templates
- Creating a Digital Signature Plug-in Implementation for E-Documents
- Creating an Outbound Validation Plug-in Implementation for E-Documents
- Creating a Custom Plug-in Implementation for E-Document Custom Data Source