users@fi.java.net

Re: Realistic generation and use of external vocabularies

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 14 Apr 2006 10:30:18 +0200

Paul Sandoz wrote:
> Alan Hudson wrote:
>
>>> Yes, very good point.
>>>
>>> It should be possible to extend the SchemaProcessor to have a methods
>>> to obtain two Map<QName, QName> for elements and attributes that maps
>>> an element/attribute to a QName of a simple data type or a list of
>>> simple data type (so it is easy to support arrays).
>>>
>> This is likely too simple to handle nested duplicate names. ie
>> Customer.Address_at_zip and Vendor.Address_at_zip where zip is a String in
>> one and an int in another. Something that indexes xpath expressions to
>> a datatype is likely needed.
>>
>
> I am not sure i understand.
>
> I would have thought the namespace name and local name should be enough
> to identify the type, as it is unlikely when using schema to get a clash
> (and if so i am not quite sure what the rules for validation are).
>

Doh! i think i got it now. In XSD any local declaration of an element
(or attribute) is distinct from any other local declaration of an
element, even if two local element declarations have the same name.

This makes it much more complicated. As you say something like XPath
might do it, for most cases. But i think to do this properly (to fully
determine the type of an element in a particular content model) requires
the use of an FSM generated from the schema.

One way to simplify this could be to provide a union of all possible
data types for a qualified name:

   Map<QName, Set<QName>>

and assume that it is not that common for there to be "overloaded"
qualified names.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109