W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2008

referencing anonymous types

From: Mark Hansen <mark@agileitinc.com>
Date: Wed, 09 Jul 2008 15:20:09 -0400
Message-ID: <48750F69.7080601@agileitinc.com>
To: xmlschema-dev@w3.org

Is there a standard syntax for generating references to anonymous 
types?  I know that XML Schema 1.0 does not provide such a standard.  
Will there be one in XML Schema 1.1 - or in some other, related, standard?

If the answer is "No", can anyone provide a link to a proprietary schema 
type naming syntax that is commonly used?  The validating parsers, like 
Xerces, must use some internal mechanism to generate names.  I'm 
wondering if there is any general consensus on how to do it.

The reason that I'm asking is that I am developing a flexible binding 
tool (named "AdaptiveBindings") for associating XML Schema components 
with programming language defined data structures.  AdaptiveBindings 
allows users to declaratively specify mappings from XML to the 
programming language - kind of like Castor mappings.  The declarative 
mapping syntax works recursively.  An XML type is mapped to a data 
structure by recursively mapping its components to the data structures 
components.  Such a mapping requires a standard mechanism for naming 
anonymous types so that they can be referenced.

Further Elaboration and Example
----------------------------------
The anonymous type naming problem that I'm talking about results when 
anonymous types are nested inside another type definition or element 
declaration.  When use in a global element definition, the anonymous 
type can be referenced by the element name.  Here is an example:

Suppose that you have the following XML 'bar' and complex type 
definition 'bar'.  I can reference the type of 'bar' using the name 
'foo'.  I can reference the type of the child element 'quantity' using 
the name 'xs:int'.  However, I cannot reference the type of child 
element 'item' using any standard syntax that I'm aware of.

<bar>
  <item>Milk</item>
  <quantity>6</quantity>
</bar>

<xs:complexType name="foo">
  <xs:sequence>
    <xs:element name="bar">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="item" type="xs:string/>
        </xs:sequence>
      <xs:complexType>
    <xs:element>
    <xs:element name="quantity" type="xs:int"/>
  <xs:sequence>
<xs:complexType>

XMLBeans provides a proprietary "Schema Type Signature" that is 
described here: 
http://xmlbeans.apache.org/docs/2.0.0/guide/conIntroToTheSchemaTypeSystem.html

Using the XMLBeans approach, the 'item' element's type would be named 
E=item|T=foo

Thanks in advance for any suggestions.

-- Mark
Received on Friday, 11 July 2008 22:21:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:05 GMT