Understanding XSD in Outbound E-Document Templates
The XSD file or XML Schema is a text file. It defines and validates what XML elements and attributes must be present in the generated XML, before it is saved as a generated e-document. A detailed audit trail message is logged if the validation fails.
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
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, the generated XML file must contain all the elements and attributes defined in the XSD. If it does, the e-document is successfully generated. Other elements and attributes can be present in the generated 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.
The Outbound XSD File field is used for validating the generated e-document, only if you select the XML format from the Content Type dropdown list.
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 Inbound 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