[ 
http://issues.apache.org/jira/browse/XMLBEANS-299?page=comments#action_12454832 
] 
            
David Jencks commented on XMLBEANS-299:
---------------------------------------

I asked about this on 7/2/2006 and Radu replied in more detail than above on 
7/27/2006.  In geronimo we have exactly this problem of needing to be able to 
extend elements with other elements that are not known at the time the "base" 
schema is compiled.

I worked around this in geronimo by:

-registering substitution group elements in each additional schema with my own 
code
-filtering validation errors by seeing if the alleged unknown element is in 
fact a member of the substitution group, using the registration info just 
mentioned
-processing all substitution group members by registering a handler for each 
possible element with a handler collection, and when the processing code 
reaches the subtitutable element it iterates through the handler collection 
giving each handler a chance.  The handlers use 
XmlObject.selectChildrenForQNameSet to look for the elements they are 
interested in.

This works but is inconvenient.

I certainly don't understand xmlbeans as well as Radu but I thought it would be 
possible to have additional schemas, as they load, register the new 
substitution group element in the data structure that track the substitution 
group elements.  I forgot where this data structure is, but I found it once 
:-).  

I think anyone who wants to use this feature would be happy to load all the 
schemas they wanted to use before processing any documents, and perhaps 
explicitly construct a SchemaTypeLoader or SchemaTypeSystem and probably call 
specific methods to register the extension schemas to get this to work.

So, I don't see why any code needs to assume anything is unknown by the time a 
document is parsed.

> Support substitution groups when the substitution is compiled in a different 
> jar
> --------------------------------------------------------------------------------
>
>                 Key: XMLBEANS-299
>                 URL: http://issues.apache.org/jira/browse/XMLBEANS-299
>             Project: XMLBeans
>          Issue Type: Improvement
>          Components: Binding
>    Affects Versions: Version 2.2, Version 2.2.1
>            Reporter: Radu Preotiuc-Pietro
>             Fix For: TBD
>
>
> XMLBeans doesn't currently support substitution groups where the head element 
> is compiled in a jar and the substitutions are compiled at a later time in a 
> different jar.
> Because XMLBeans doesn't have the opportunity to save in the serialized xsb 
> information about substitution groups (since these do not exist at the time 
> the xsb is created) then it is forced to assume that any element can be a 
> substitution for anything else and the only way to reliably tell is to load 
> the element declaration. But loading the element declaration each time two 
> elements are compared for QName equality is going to be very expensive even 
> if loaded from the cache. This whole thing will need to be enabled on-request 
> and have its separate codepath.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to