[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Various comments
Hi, I've been experimenting a bit with RELAX NG (12 June) (actually trying to put together a RELAX NG schema for XML Schema for fun). This is just a few observations from that. I'm not up on your recent discussions, so I apologise if this covers old ground. Resolving QName values: The tutorial says that you can use the type attribute on the value element to indicate the data type that the value should be judged against. I have a data type of xs:QName (though I can't call it that - I preferred the earlier version when I could). The tutorial doesn't specify which namespace definitions the prefix is resolved against (I guess the ones in scope for the pattern). This also raises the question of how to make the no-namespace/default-namespace distinction within the value. Should <value type="QName">string</value> use the default namespace or no namespace? I guess from the similar thing of using qualified names for elements and attributes, the default namespace declaration wouldn't be used? ---- The not name class: It's a bit tedious having to put a choice element around any name classes that I use within a not element: <not> <choice> <nsName /> <nsName ns="" /> </choice> </not> I think it would be more convenient if: <not> name-classes </not> were equivalent to: <difference><anyName /><choice> name-classes </choice></difference> I don't think that this would have any effect on the logic? ---- Excluding attribute values: I'd like to be able to restrict the contents of the xs:restriction element based on its base attribute, but only for certain values. So if its base attribute is "xs:decimal" then it could contain xs:totalDigits but if it's "xs:string" then it can't, and so on. However, if it's not a name in the 'xs' namespace, then I want to allow any content. Best would be to exclude all QName values with a particular namespace, but XMLSchema-datatypes doesn't offer that as a facet (and therefore RELAX NG doesn't have it as a parameter). I don't want to use the 'pattern' parameter to test the names because that would undermine the namespace awareness of the schema. I thought I could create a pattern that didn't match particular enumerated values, but I can't find a way to do so. What I'm looking for is something like: <choice> <group> <attribute name="foo"> <value>bar</value> </attribute> <element name="bar"><empty /></element> </group> <group> <attribute name="foo"> <!-- not current RELAX NG --> <not> <value>bar</value> </not> <!-- /not current RELAX NG --> </attribute> <element name="baz"><empty /></element> </group> </choice> This use case would imply that the difference element would be useful outside name classes as well. ---- Keys and KeyRefs: As you know, XML Schema has a number of built in data types, and you can define more yourself. In a standalone schema (i.e. one that doesn't import/include/redefine any others) then the type attribute on a xs:attribute has to point to one of these types. The first thing here is that it's impossible to use key/keyRef in this situation as RELAX NG currently stands because the type attribute might point to a built-in type, one that isn't specified through a simple type definition somewhere else in the schema. I can't do a choice between a reference to a type and enumerated set of names because of the restrictions on knowing whether an attribute is a keyRef described at the bottom of Section 12. The second thing is that it would be useful to allow a particular element/attribute to be a key in multiple symbol spaces. This comes into play here because I want to make sure (a) that xs:simpleType and xs:complexType names don't clash [i.e. have a 'types' symbol space] and (b) that the type attribute of xs:attribute refers to *only* a xs:simpleType [i.e. have a 'simpleTypes' symbol space]. So I'd like to be able to do: <element name="simpleType"> <attribute name="name"> <!-- not current RELAX NG --> <data type="NCName" key="types simpleTypes" /> <!-- /not current RELAX NG --> </attribute> </element> <element name="element"> <attribute name="type"> <data type="NCName" keyRef="types" /> </attribute> </element> <element name="attribute"> <attribute name="type"> <data type="NCName" keyRef="simpleTypes" /> </attribute> </element> (In fact I can't use key/keyRef here at all, because of the multiple documents and the fact that some complex namespace resolution goes on because the type attributes in XML Schema are actually QNames and so on, of course. I guess it's time to get Schematron out ;) That's it for now, though I'm only about 1/4 way through so I may be back! Thanks for listening, Jeni --- Jeni Tennison http://www.jenitennison.com/
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC