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 Krishna Gopal Binyala <kg...@gmail.com> on 2009/01/07 06:30:05 UTC
How to extract include and import from schema
Hello,
I am using xerces, framework for Schema parsing, i need to extract
<xsd:include> and <xsd:import> from the schema and manipulate the
schemaLocation from.
I am XSModel for this, but not able to retrieve include and import from schema
How it can be achieved. ???
Thanks,
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: How to extract include and import from schema
Posted by Stanimir Stamenkov <s7...@netscape.net>.
Wed, 7 Jan 2009 11:00:05 +0530, /Krishna Gopal Binyala/:
> I am using xerces, framework for Schema parsing, i need to extract
> <xsd:include> and <xsd:import> from the schema and manipulate the
> schemaLocation from.
>
> I am XSModel for this, but not able to retrieve include and import from schema
>
> How it can be achieved. ???
May be not exactly what you want but you may iterate over the
XSModel.namespaceItems [1], then for each observe its
XSNamespaceItem.documentLocations [2].
Alternatively you may parse the documents in a straightforward
fashion. Using SAX you could memory and speed effectively break
parsing for each location right after encountering the first
non-(include | import | redefine | annotation) [3] element, throwing
a custom SAXException from withing your ContentHandler code and
handling it explicitly where you invoke the parser.
Using the later doesn't exclude your possible need of the XSModel
already built. I've used both approaches - separately and in
conjunction to build an augmented XML Schema model with info
specific to my processing.
[1]
<http://xerces.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/XSModel.html#getNamespaceItems()>
[2]
<http://xerces.apache.org/xerces2-j/javadocs/xs/org/apache/xerces/xs/XSNamespaceItem.html#getDocumentLocations()>
[3] <http://www.w3.org/TR/xmlschema-1/#declare-schema>
--
Stanimir
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: How to extract include and import from schema
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
"Krishna Gopal Binyala" <kg...@gmail.com> wrote on 01/07/2009 12:30:05
AM:
> Hello,
> I am using xerces, framework for Schema parsing, i need to extract
> <xsd:include> and <xsd:import> from the schema and manipulate the
> schemaLocation from.
>
> I am XSModel for this, but not able to retrieve include and import from
schema
>
> How it can be achieved. ???
You can't. XSModel was not designed for this purpose. See recent discussion
in the mailing list archives [1] for more info.
> Thanks,
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
Thanks.
[1] http://markmail.org/message/x3fwoet6l7co4zbj
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org