You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Johnson, Matthew C. (LNG-HBE)" <Ma...@lexisnexis.com> on 2010/10/03 16:20:13 UTC

finding containing context

Sorry, I am resending this because I'm not sure if the original made it.

________________________________
From: Johnson, Matthew C. (LNG-HBE)
Sent: Friday, October 01, 2010 3:47 PM
To: j-users@xerces.apache.org
Subject: finding containing context

Hi all,

I am looking to use the Xerces API to 1) build an in-memory representation of a XML Schema (XSD) and 2) “query” that representation.  An example query is to list all of the contexts in which a given element is allowed.  As of now, I have been able to use the XMLSchemaLoader class to get a XSModel instances from which I can do simple things such as listing all namespaces in addition to get the definition of a known element.  However, I am not seeing how to do things like getting a list of all elements allowed (from which I could build a map).  Could someone give me a pointer on where to look?  Thanks.

Matt






---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: finding containing context

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Matt,

You need to walk into the ComplexTypeDefinition [1] objects in order to
build such a map. The getParticle() [2] method is the entry point for the
content model information.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/XSComplexTypeDefinition.html
[2]
http://xerces.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/XSComplexTypeDefinition.html#getParticle%28%29

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Johnson, Matthew C. (LNG-HBE)" <Ma...@lexisnexis.com> wrote on
10/03/2010 10:20:13 AM:

> Sorry, I am resending this because I'm not sure if the original made it.
>
> ________________________________
> From: Johnson, Matthew C. (LNG-HBE)
> Sent: Friday, October 01, 2010 3:47 PM
> To: j-users@xerces.apache.org
> Subject: finding containing context
>
> Hi all,
>
> I am looking to use the Xerces API to 1) build an in-memory
> representation of a XML Schema (XSD) and 2) ?query? that
> representation.  An example query is to list all of the contexts in
> which a given element is allowed.  As of now, I have been able to
> use the XMLSchemaLoader class to get a XSModel instances from which
> I can do simple things such as listing all namespaces in addition to
> get the definition of a known element.  However, I am not seeing how
> to do things like getting a list of all elements allowed (from which
> I could build a map).  Could someone give me a pointer on where to
> look?  Thanks.
>
> Matt
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org