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-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org