Schema validation of XSLT, SVG, XPath: Part 2: Multiple Lexical R
epresentation
Arnold, Curt
Curt.Arnold at hyprotech.com
Wed Dec 8 18:38:02 GMT 1999
Sorry about the duplicate (or near duplicate) Part 1 messages. I'm not
really sure how that happened.
This part makes some simple modifications that greatly simplify specifying
the lexical represention of data types that have several forms.
Here are some productions that would be difficult to enforce without the
suggested modifications.:
NameTest from XPath:
NameTest ::= '*'
| NCName ':' '*'
| QName
NCName from XML Namespaces:
4] NCName ::= (Letter | '_') (NCNameChar)
The SVG path data datatype (datatype of the d attribute)
<path d="M 100 100 L 140 100 L 120 140 z"/>
Proposal:
After reviewing the current datatypes doc, I'm a little confused with what
happened with the previous lexicalRepresentation element. The
interpretation of pattern and lexical are not adequately discussed. I'm
moving more things around than I thought that I would need to, but here
goes. Here are what I think would be reasonable renderings of the previous
production patterns.
<datatype name="nameTest">
<basetype name="string"/>
<!-- this is using the lexical element to represent all legal string
encodings of nameTest
for a string to be a valid nameTest one of the exclosed
patterns must match and
must conform to the lexical representation of the
base type
-->
<lexical>
<!-- could be just an asterisk -->
<pattern>\*</pattern>
<!-- matching this pattern means that it matches the
namespaceWildcard datatype and the
default pattern of ".*" -->
<pattern datatype="namespaceWildcard"/>
<pattern datatype="qname"/>
</lexical>
</datatype>
<datatype name="namespaceWildcardFragments">
<basetype name="string"/>
<lexical>
<pattern datatype="ncname"/>
<pattern>:</pattern>
<pattern>\*</pattern>
</lexical>
</datatype>
</datatype name="namespaceWildcard">
<basetype name="namespaceWildcardFragments"/>
<list minOccur="3" maxOccur="3"/>
<!-- regex constraint on entire list, making sure that the last two
characters are :* ->
<lexical><pattern>.*:\*</pattern></lexical>
</datatype>
<datatype name="qnameFragments">
<lexical>
<pattern datatype="ncname"/>
<pattern>:</pattern>
</lexical>
</datatype>
<datatype name="qname">
<basetype name="qnameFragments"/>
<list minOccur="1" maxOccur="3"/>
<lexical>
<!-- matches any two character or longer string that
doesn't have an initial or final colon -->
<pattern>[^:].*[^:]</pattern>
<!-- matches any non-colon single character string -->
<pattern>[^:]</pattern>
</lexical>
</datatype>
<datatype name="ncname">
<basetype name="nmtoken"/>
<!-- disallow colon from nmtoken -->
<lexical><pattern>[^:]*</pattern>
</datatype>
<!-- SVG example -->
<datatype name="svgcoord">
<basetype name="real"/>
<list minOccur="2" maxOccur="2"/>
</datatype>
<datatype name="moveCommandFragment">
<basetype name="string"/>
<lexical>
<pattern>[Mm]</pattern>
<pattern datatype="svgcoord"/>
</lexical>
</datatype>
<datatype name="moveCommand">
<basetype name="moveCommandFragment"/>
<list minOccur="2"/>
<lexical>
<pattern>[Mm][^Mm]*</pattern>
</lexical>
</datatype>
... omited for other SVG productions
<datatype name="pathdataItem">
<basetype name="string"/>
<lexical>
<pattern datatype="moveCommand"/>
<pattern datatype="curvetoCommand"/>
<pattern datatype="smoothCommand"/>
<pattern datatype="arcCommand"/>
...
</lexical>
</datatype>
<datatype name="pathdata">
<basetype="pathdataItem"/>
<list/>
</datatype>
<attribute name="d" datatype="pathdata"/>
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list