[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Schema problem: different element types with the same
I'm dealing with some legacy XML documents and try to develop a schema to validate them. They contain sequences like: [...] <mmc:param name="asp.frameset">view-book</mmc:param> <mmc:param name="suppress.index.list.when.no.input">0</mmc:param> [...] The first element content must be name token (without spaces), the second a boolean value. My first try was to define two separate types and to apply then to the param element, like in the example below. But obviously I cannot have two elements with the same name and different types in a sequence. Is there a work-around? I know that those elements should better be attributes. But changing the legacy code before verifying it is not an option. I could also relax the type and code both param elements as type string, but then I could not verify the element content. How should I proceed? [...] <xs:complexType name="paramAspFrameset" mixed="true"> <xs:simpleContent> <xs:extension base="xs:NMTOKEN"> <xs:attribute name="name" fixed="asp.frameset" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="paramSuppressIndexListWhenNoInput" mixed="true"> <xs:simpleContent> <xs:extension base="xs:boolean"> <xs:attribute name="name" fixed="suppress.index.list.when.no.input"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="text2index"> <xs:sequence> [...] <xs:element name="param" type="mmc:paramAspFrameset" minOccurs="1" maxOccurs="1"/> <xs:element name="param" type="mmc:paramSuppressIndexListWhenNoInput" minOccurs="1" maxOccurs="1"/> [...] </xs:sequence> </xs:complexType> [...]
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|