XML Schema
To provide as-you-type validation and to compute valid insertion proposals, Oxygen XML Author plugin needs an XML grammar (XML Schema, DTD, or RelaxNG) associated to the XML. The grammar specifies how the internal structure of the XML is defined. For information about associating a schema and how Oxygen XML Author plugin detects the schema, see Associating a Schema to XML Documents.
Consider a use-case in which several users are testing a system and must send report
results
to a content management system. The customization should provide a visual editor for
these
kind of documents. The following XML Schema, test_report.xsd
defines a
report with results of a testing session. The report consists of a title, few lines
describing
the test suite that was run, and a list of test results (each with a name and a boolean
value
indicating if the test passed or failed).
<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="report"> <xs:complexType> <xs:sequence> <xs:element ref="title"/> <xs:element ref="description"/> <xs:element ref="results"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="title" type="xs:string"/> <xs:element name="description"> <xs:complexType> <xs:sequence maxOccurs="unbounded"> <xs:element name="line"> <xs:complexType mixed="true"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element name="important" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="results"> <xs:complexType> <xs:sequence maxOccurs="unbounded"> <xs:element name="entry"> <xs:complexType> <xs:sequence> <xs:element name="test_name" type="xs:string"/> <xs:element name="passed" type="xs:boolean"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>