[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Schema problem: different element types with the same

Subject: Schema problem: different element types with the same name
From: Sascha Mantscheff <922492@xxxxxx>
Date: Thu, 06 Dec 2007 14:04:44 +0100
 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>
[...]

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.