Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Pattern constraint on string content of complexType having attribute and choice

From: Wyatt Barton <hiddenharvest@-----.--->
To: xmlschema-dev@--.---
Date: 8/10/2004 10:24:00 PM
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


From xan.gregg@j... Wed Aug 11 13:00:54 2004
Received: from dr-nick.w3.org ([18.29.1.73])
	by frink.w3.org with esmtp (Exim 4


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent