Posted to tcl by mjanssen at Fri Oct 30 13:41:06 GMT 2015view raw
- This:
- text {<?xml version="1.0" encoding="UTF-8"?>}
- text {<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">}
- define root {
- item+
- }
- define item {
- part1!
- part2?
- part3
- }
- define part1 xsd:string
- define part2 xsd:decimal {This is optional}
- extension part3 xsd:normalizedString {{attr1 {this is attr1}}} {
- Complex stuff
- }
- text "</xsd:schema>"
- Becomes:
- <?xml version="1.0" encoding="UTF-8"?>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xsd:element name="root" type="rootType"/>
- <xsd:complexType name="rootType">
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="unbounded" ref="item"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="item" type="itemType"/>
- <xsd:complexType name="itemType">
- <xsd:sequence>
- <xsd:element minOccurs="1" maxOccurs="1" ref="part1"/>
- <xsd:element minOccurs="0" maxOccurs="1" ref="part2"/>
- <xsd:element ref="part3"/>
- </xsd:sequence>
- </xsd:complexType>
- <xsd:element name="part1" type="xsd:string"/>
- <xsd:element name="part2" type="xsd:decimal">
- <xsd:annotation>
- <xsd:documentation>This is optional</xsd:documentation>
- </xsd:annotation>
- </xsd:element>
- <xsd:element name="part3" type="part3Type"/>
- <xsd:complexType name="part3Type">
- <xsd:annotation>
- <xsd:documentation>
- Complex stuff
- </xsd:documentation>
- </xsd:annotation>
- <xsd:simpleContent>
- <xsd:extension base="xsd:normalizedString">
- <xsd:attribute name="attr1" use="optional">
- <xsd:annotation>
- <xsd:documentation>this is attr1</xsd:documentation>
- </xsd:annotation>
- </xsd:attribute>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:schema>