- From: Biron,Paul V <Paul.V.Biron@kp.org>
- Date: Wed, 3 Apr 2002 12:14:01 -0800
- To: "'Daniel Veillard'" <veillard@redhat.com>, W3C XML Schema Comments list <www-xml-schema-comments@w3.org>
> -----Original Message----- > From: Daniel Veillard [SMTP:veillard@redhat.com] > Sent: Wednesday, April 03, 2002 11:04 AM > To: W3C XML Schema Comments list > Subject: Bug in the Schemas for schemas > > Apparently the regular expressions given for matching XPath > strings are incorrect: > good catch...see below. > XMLSchema.xsd around line 1061 (there is a similar problem for > the "selector" definition). > > ------------------- > <xs:attribute name="xpath" use="required"> > <xs:simpleType> > <xs:annotation> > <xs:documentation>A subset of XPath expressions for use > in selectors</xs:documentation> > <xs:documentation>A utility type, not for public > use</xs:documentation> > </xs:annotation> > <xs:restriction base="xs:token"> > <xs:annotation> > <xs:documentation>The following pattern is intended to allow > XPath > expressions per the following EBNF: > Selector ::= Path ( '|' Path )* > Path ::= ('.//')? Step ( '/' Step )* > Step ::= '.' | NameTest > NameTest ::= QName | '*' | NCName ':' '*' > child:: is also allowed > </xs:documentation> > </xs:annotation> > <xs:pattern > value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*: > )?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((c > hild::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*"> > </xs:pattern> > </xs:restriction> > </xs:simpleType> > </xs:attribute> > ------------------- > > Ah ... Back to the definition: > > http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#nt-MultiCharEsc > \c the set of name characters, those matched by NameChar > > Which point to: > > http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-NameChar > [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | > CombiningChar | Extender > > and ':' is part of NameChar as defined by the XML specification. > > XPath when defining the NameTest actually referenced the Namespace in XML > REC > to avoid this problem: > > http://www.w3.org/TR/xpath#NT-NameTest > > http://www.w3.org/TR/REC-xml-names/#NT-NCName > [4] NCName ::= (Letter | '_') (NCNameChar)* /* An XML Name, minus the > ":" */ > [5] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | > Extender > > Conclusion: > - The Schemas for Schemas does not define a subset of XPath, damn... > > Suggestions: > - Change the definition to base it either on the XPath specification > or > Namespace in XML specs references > - Change the regular expression occurences of "\i\c*" > Yes, all occurances of "\i\c*" should be changed to "[\i-[:]][\c-[:]]*" (that is, remove : from the set allowed characters). pvb p.s. that's going to make the regex REALLY ugly...as if it isn't ugly enough to begin with :-)
Received on Wednesday, 3 April 2002 15:37:03 UTC