You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by ps...@telecom.ntua.gr on 2007/08/14 22:28:26 UTC

find already loaded schematypes/SchemaTypeSystem

Hi all,

I would like to ask the following two questions:

1) Is there any way to find out the already loaded
schemaTypes/documents/schemaGlobalElements etc.?
I want to make a list with the already load SchemaTypes without any prior
knowledge
of the available compiled schemas.
I tried to use (obviously with a wrong way) the static method
XmlBeans.compileXsd(null, XmlBeans.getContextTypeLoader(), xmlOptions)
hopping that the returned instance of SchemaTypeSystem would have taken
into the
consideration the already loaded classes by the ContextTypeLoader
(the corresponding jars with the compiled schemas have already been loaded
before invoking
the method above)

2) This question is related to the previous one since I want to find the
substitution
groups. I suppose that the information about the substitution groups could
be retrieved
from the SchemaGlobalElement via the substitutionGroup() method, and the
SchemaGlobalElement
could be retrieved from the SchemaTypeSystem. Is the right way? Is there
any different way?
How could I retrieve the current SchemaTypeSystem?

I really appreciate any help,

kind regards,

John Ps.




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: find already loaded schematypes/SchemaTypeSystem (repost)

Posted by Psoroulas John <ps...@telecom.ntua.gr>.
Thanks a lot for your answer Radu

Best Regards,

John Ps.

On Fri, August 17, 2007 01:22, Radu Preotiuc-Pietro wrote:
> There is no way to find that out. To understand why, consider a parallel
> with Java classloaders. You can't rely on a set of "already loaded" classes
> because classloaders may unload classes at any time. All that matters is
> whehter a given loader can load a class or not, the rest is optimization.
> The same argument applies for SchemaTypeLoaders, moreover
> SchemaTypeLoaders are based on ClassLoaders.
>
>
> About the substitution groups question, there is no such thing as
> "current SchemaTypeSystem". SchemaTypeSystems are collections of Schema
> types and elements (and attributes, model groups etc). One document can
> easily contain references to multiple SchemaTypeSystems. But, each
> document is parsed in the context of a SchemaTypeLoader (see
> SchemaTypeLoader.parse() methods). The most reliable way to get a
> SchemaGlobalElement then is to use the
> SchemaTypeLoader.findElement(QName) method.
>
>
> In conclusion, to draw on a parallel with Java again, there is no way to
> get "all the global elements that the system could potentially know about"
> just as (and because of in fact) there is no way to get in Java "all the
> classes that the system could potentially load". There is a somewhat long
> discussion on why this is the right design, but I do believe it is the
> right design.
>
> Radu
>
>
> On Thu, 2007-08-16 at 10:36 +0300, psoroulas@telecom.ntua.gr wrote:
>
>> Hi all,
>>
>>
>> maybe is a silly question, but I really need to know if there is an
>> answer to the question described below.
>>
>> I really appreciate any help
>>
>>
>> Best regards,
>>
>>
>> John Ps.
>>
>>
>> On Tue, August 14, 2007 23:28, psoroulas@telecom.ntua.gr wrote:
>>
>>> Hi all,
>>>
>>>
>>>
>>> I would like to ask the following two questions:
>>>
>>>
>>>
>>> 1) Is there any way to find out the already loaded
>>> schemaTypes/documents/schemaGlobalElements etc.? I want to make a list
>>> with the already load SchemaTypes without any prior knowledge of the
>>> available compiled schemas. I tried to use (obviously with a wrong
>>> way) the static method XmlBeans.compileXsd(null,
>>> XmlBeans.getContextTypeLoader(),
>>> xmlOptions) hopping that the returned instance of SchemaTypeSystem
>>> would have taken into the consideration the already loaded classes by
>>> the ContextTypeLoader
>>> (the corresponding jars with the compiled schemas have already been
>>> loaded before invoking the method above)
>>>
>>> 2) This question is related to the previous one since I want to find
>>> the substitution groups. I suppose that the information about the
>>> substitution groups could be retrieved from the SchemaGlobalElement
>>> via the substitutionGroup() method, and the SchemaGlobalElement could
>>> be retrieved from the SchemaTypeSystem. Is the right way? Is there any
>>> different way? How could I retrieve the current SchemaTypeSystem?
>>>
>>>
>>> I really appreciate any help,
>>>
>>>
>>>
>>> kind regards,
>>>
>>> John Ps.
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>>  To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>>
>>
>
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: find already loaded schematypes/SchemaTypeSystem (repost)

Posted by Radu Preotiuc-Pietro <ra...@bea.com>.
There is no way to find that out. To understand why, consider a parallel
with Java classloaders. You can't rely on a set of "already loaded"
classes because classloaders may unload classes at any time. All that
matters is whehter a given loader can load a class or not, the rest is
optimization. The same argument applies for SchemaTypeLoaders, moreover
SchemaTypeLoaders are based on ClassLoaders.

About the substitution groups question, there is no such thing as
"current SchemaTypeSystem". SchemaTypeSystems are collections of Schema
types and elements (and attributes, model groups etc). One document can
easily contain references to multiple SchemaTypeSystems. But, each
document is parsed in the context of a SchemaTypeLoader (see
SchemaTypeLoader.parse() methods). The most reliable way to get a
SchemaGlobalElement then is to use the
SchemaTypeLoader.findElement(QName) method.

In conclusion, to draw on a parallel with Java again, there is no way to
get "all the global elements that the system could potentially know
about" just as (and because of in fact) there is no way to get in Java
"all the classes that the system could potentially load". There is a
somewhat long discussion on why this is the right design, but I do
believe it is the right design.

Radu

On Thu, 2007-08-16 at 10:36 +0300, psoroulas@telecom.ntua.gr wrote:
> Hi all,
> 
> maybe is a silly question, but I really need to know
> if there is an answer to the question described below.
> 
> I really appreciate any help
> 
> Best regards,
> 
> John Ps.
> 
> On Tue, August 14, 2007 23:28, psoroulas@telecom.ntua.gr wrote:
> > Hi all,
> >
> >
> > I would like to ask the following two questions:
> >
> >
> > 1) Is there any way to find out the already loaded
> > schemaTypes/documents/schemaGlobalElements etc.? I want to make a list with
> > the already load SchemaTypes without any prior knowledge of the available
> > compiled schemas. I tried to use (obviously with a wrong way) the static
> > method XmlBeans.compileXsd(null, XmlBeans.getContextTypeLoader(),
> > xmlOptions) hopping that the returned instance of SchemaTypeSystem would
> > have taken into the consideration the already loaded classes by the
> > ContextTypeLoader
> > (the corresponding jars with the compiled schemas have already been loaded
> >  before invoking the method above)
> >
> > 2) This question is related to the previous one since I want to find the
> > substitution groups. I suppose that the information about the substitution
> > groups could be retrieved from the SchemaGlobalElement via the
> > substitutionGroup() method, and the SchemaGlobalElement
> > could be retrieved from the SchemaTypeSystem. Is the right way? Is there
> > any different way? How could I retrieve the current SchemaTypeSystem?
> >
> >
> > I really appreciate any help,
> >
> >
> > kind regards,
> >
> > John Ps.
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> >
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


find already loaded schematypes/SchemaTypeSystem (repost)

Posted by ps...@telecom.ntua.gr.
Hi all,

maybe is a silly question, but I really need to know
if there is an answer to the question described below.

I really appreciate any help

Best regards,

John Ps.

On Tue, August 14, 2007 23:28, psoroulas@telecom.ntua.gr wrote:
> Hi all,
>
>
> I would like to ask the following two questions:
>
>
> 1) Is there any way to find out the already loaded
> schemaTypes/documents/schemaGlobalElements etc.? I want to make a list with
> the already load SchemaTypes without any prior knowledge of the available
> compiled schemas. I tried to use (obviously with a wrong way) the static
> method XmlBeans.compileXsd(null, XmlBeans.getContextTypeLoader(),
> xmlOptions) hopping that the returned instance of SchemaTypeSystem would
> have taken into the consideration the already loaded classes by the
> ContextTypeLoader
> (the corresponding jars with the compiled schemas have already been loaded
>  before invoking the method above)
>
> 2) This question is related to the previous one since I want to find the
> substitution groups. I suppose that the information about the substitution
> groups could be retrieved from the SchemaGlobalElement via the
> substitutionGroup() method, and the SchemaGlobalElement
> could be retrieved from the SchemaTypeSystem. Is the right way? Is there
> any different way? How could I retrieve the current SchemaTypeSystem?
>
>
> I really appreciate any help,
>
>
> kind regards,
>
> John Ps.
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org