You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by John Kaputin <KA...@uk.ibm.com> on 2005/09/08 14:43:04 UTC

Parsing XML Schema in Woden

I have been considering how best to parse XML Schema components in Woden
and how to store the underlying schema elements and types for Woden
applications that may need to access them. My current design stores the
parsed schema, schema element and schema types in fields of type
java.lang.Object called 'content' and a String field called 'contentModel'
indicates which API is being used to represent those schema components
(e.g. DOM or XML Schema API, etc.).  The content model strings are defined
in a Constants file.

An application requiring access to the underlying element and types would
need to (1) support the API being used and (2) cast the 'content' Object to
the appropriate type (org.w3c.dom.Element,
org.apache.xerces.xs.XSElementDeclaration,
org.apache.xerces.xs.XSTypeDefinition, etc).   The idea was to be able to
support appropriate schema APIs for different types of XML parsing (DOM,
StAX, etc) or for different schema type systems based on the XML infoset
(XML Schema, RelaxNG, etc). So for example, the XMLSchema API might be used
with DOM parsing but maybe something else with StAX parsing.

My initial attempt has been to use the XML Schema API in Xerces because I
was working on the DOM parsing and using Xerces and wanted a quick route to
the schema elements and types to implement the ElementDeclaration and
TypeDefinition components so I could get on with the rest of the WSDL
component model. I expected to revisit the choice XML Schema API as some
point.

However for the DOM implementation this choice does introduce a
parser-specific dependency on Xerces. An alternative might be to parse the
schema just using SAX and DOM (and JAXP).  With either approach we still
need to consider dependency issues with multiple XML parser support (e.g.
if both the DOM and StAX support is packaged in a single Woden download).
Configuation options are probably the answer.

Dim's suggestion of using the XmlSchema model in ws-commons sounds good,
especially if can be used with any XML parser in Woden to provide a common
XML Schema object model. A common object model for Schema in Woden might
avoid the need to use java.lang.Object and casting, but we'd still need to
consider support for other type systems.  I'm currently investigating
XmlSchema further.
regards,
John Kaputin


---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org