- From: Wyatt Barton <hiddenharvest@yahoo.com>
- Date: Wed, 11 Aug 2004 05:23:50 -0700 (PDT)
- To: xmlschema-dev@w3.org
Hello;
I am struggling with the XML Schema documentation
(_W3C Recommendation, 2 May 2001_) more than with
nearly any technical specs I've read in 35 years of
programming. Someone who understands the Schema
syntax, please help!
[HT et al: for the future, please consider adding to
your team a specialist in *technical documentation*
who could help organise/present the design and syntax
of this excellent language in a lucid manner for
readers who are not immersed in its conceptual
framework; the orange-highlighted "[Definition:]"
parts help in this regard; JT, for one, seems to
understand the design and is somehow able to write
about it in a way that is technically precise but
more accesible.]
Our current problem -- with which I need help
urgently -- is basically this:
(a) we require a Schema Element type that accepts
tag Attributes and a Choice of child Elements; *plus*
(b) a RegEx Pattern constraint on string character
data that can appear between the tags of this Element
type.
[In our app, it is not acceptable to delimit the
constrained character data by a separate tags as a
child to the aforementioned Element type, such that
the character data can be constrained within a
simpleType Element.]
It is clear to me that a simpleType, per se, cannot
be extended.
Q1: Can we 'promote' a simpleType to a complexType
in some way, eg, the following?
<xs:simpleType name="base_Type-ST" abstract="true">
<xs:restriction base="xs:string">
<xs:pattern value="[...myRegEx...]"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="base_Type-CT" abstract="true">
<xs:simpleContent>
<xs:extension base="base_Type-ST"/>
</xs:simpleContent>
</xs:complexType>
And, then use the 'promoted' type in our target
complexType declaration by extension, eg, the
following?
<xs:complexType name="target_Type" mixed="true">
<xs:complexContent mixed="true">
<xs:extension base="base_Type-CT">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="location-specific_Comment"
type="xs:string"/>
</xs:choice>
<xs:attribute name="this_Element_ID"
type="xs:ID" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Q2: Alternatively, is there a way to constrain the
string character-data content of a complexType by
restricting its type in another complexType
declaration, eg, something like the following?
<xs:complexType name="base_Type" mixed="true"
abstract="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="location-specific_Comment"
type="xs:string"/>
</xs:choice>
<xs:attribute name="this_Element_ID" type="xs:ID"
use="required"/>
</xs:complexType>
<xs:complexType name="target_Type" mixed="true">
<xs:simpleContent>
<xs:restriction base="base_Type">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[...myRegEx...]"/>
</xs:restriction>
</xs:simpleType>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
Many thanks in advance for help, :-)
- Wyatt
Received on Wednesday, 11 August 2004 12:31:47 UTC