[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSchema: Element references and namespaces
I was writing section 4 (conversions) yesterday and realized we have a problem referring to elements by name from Ref, AttDef, and AttGroup elements. For example: <ElementDecl Name="foo" ns="http://myfoo.org" prefix="myfoo"> ... </ElementDecl> <ElementDecl Name="foo" ns="http://yourfoo.org" prefix="yourfoo"> ... </ElementDecl> <ElementDecl Name="refersToFoo"> <Model> <Ref Element="foo"/> </Model> </ElementDecl> Which foo does the Element attribute in the content model of refersToFoo refer to? I see two solutions to this: 1) Refer to elements by ID. I don't like this from a usability standpoint -- it is far more natural to refer to elements by name. 2) Add nsElement and (possibly) prefixElement attributes to Ref, AttDef, and AttGroup. This matches our namespace implementation, which uses a two-part naming system (Name + ns). Note 1: We cannot name these attributes ns and prefix, as those already exist on AttDef and AttGroup and apply to the value of the Name attribute. Note 2: prefixElement is not strictly necessary -- you could get the prefix from the ElementDecl, AttGroup, or AttDef. Although it makes it possible for the user to introduce conflicting prefixes, it also makes conversion to a DTD much easier. Because references can occur before declarations, you can't guarantee a successful prefix lookup when you need it. Thus, you must either make two passes over the XSchema or build an in-memory tree before outputting anything. I would rather add prefixElement and have the checker check that it matches the relevant prefix. Note 3: Can nsElement inherit from ns and prefixElement inherit from prefix? In many (most?) cases, the content model of elements will refer to elements in the same namespace as the element being defined and attributes will belong to the same namespace as the element to which they apply. Thus, it would be nice to omit nsElement and just apply ns from the enclosing ElementDecl, AttGroup, or AttDef. However, inheriting from one attribute to another is definitely not in the spirit of XML and makes me a bit queasy. -- Ron Bourret xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|