OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] DTDs, W3C Schemas, RELAX NG, Schematron?

[ Lists Home | Date Index | Thread Index ]

> But restrictions by facet are only pre-set ones.  You can restrict
> an integer to be between -5 and +5, but you can't restrict a token,
> say, not to be "foo".  Whereas in RNG that is just xsd:token - "foo".

True.

> > > 11) RNG lists consist of non-whitespace separated by whitespace, and the
> > > non-whitespace need not be all of the same (simple) type.  A pattern like
> > > "list {xsd:integer, xsd:string}+" is perfectly valid, and matches content
> > > like "2 foo 5 bar".
> >
> > This can be done by creating a list type from a union type in XML Schema.
>
> True.  I didn't word this sharply enough.  If you want a list consisting
> of alternating numbers and strings, RNG can do that but XSD can't:
> a list type created from a union type is "list {(xsd:integer|xsd:string}+}",
> and matches things like "2 5 foo bar".

True, although you probably could create something similar by adding a pattern
facet to the list type. For example, the above could be done with:

<xs:simpleType name="List">
  <xs:list>
    <xs:simpleType>
      <xs:union memberTypes="xs:string xs:integer"/>
    </xs:simpleType>
  </xs:list>
</xs:simpleType>

<xs:simpleType name="restrictedList">
  <xs:restriction base="List">
    <xs:pattern value="((\d+ .+) ?)+"/>
  </xs:restriction>
</xs:simpleType>

But for more complex lists this wouldn't work very well and the RELAX-NG way is
much clearer and easier.

Cheers,
/Eddie





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS