xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ne...@ca.ibm.com
Subject Re: using XML schemas embedded in other files
Date Fri, 01 Nov 2002 20:12:53 GMT
Hi Jeff,

The trouble with embedded schemas is that it's not at all clear what their
semantics should be.  For instance, should it be the case that a parser
should automatically start building a schema, whenever it sees an element
named <schema> from the http://www.w3.org/2001/XMLSchema namesace?  Should
there be a feature to control this behaviour?  Should the "embedded" schema
be used to validate the rest of the document--or whatever portions of the
document align with its targetNamespace?

It's possible that  there might be some direction from the schema WG on
that front; I'm curious what your preference would be?

As to your specific problem:  I think your solution #2 is best.  In terms
of making parsed schemas permanent or transitory, you probably want to
extend our grammar pool implementation; you could use a "shadow" design
pattern, for instance:  i.e., have your transitory grammars in a clearable,
main pool and your permanent ones in a grammar pool that would be attached
to the main one, and referenced if nothing was found in the main pool.  You
could then freely add and remove things from the main pool however you

Just some thoughts.  We haven't thought much yet about in-line schemas, so
all input welcome!  Especially with the rising importance of WSDL, it would
be good to get a handle on this stuff.

Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:  905-413-3519, T/L 969-3519
E-mail:  neilg@ca.ibm.com

|         |           "Jeff Greif"      |
|         |           <jgreif@alumni.pri|
|         |           nceton.edu>       |
|         |                             |
|         |           10/29/2002 05:27  |
|         |           PM                |
|         |           Please respond to |
|         |           xerces-j-user     |
|         |                             |
  |       To:       <xerces-j-user@xml.apache.org>                                 
  |       cc:                                                                            
  |       Subject:  using XML schemas embedded in other files                            

WSDL files may contain XML Schemas, or may import .xsd or other .wsdl files
that may contain schemas.  I would like to be able to refer the locations
these schemas using some kind of URI + fragment notation in the spirit of
XPointer, and integrate this usage with Xerces 2.

For example, I would like to return the result of a web service invocation
to a client program, telling it the QName of the type of the result, and
specifying the location of the schema defining that type.  Among the
possibilities I can think of to do this are:
  1.  Extend the external schemaLocation mechanism and/or the schemaLoader
class to handle URI#xpath("/some-path/xsd:schema") types of locations.  I
think this would require producing variants of several implementation
classes, which seems of dubious merit, particularly given the frequency of
Xerces releases.
  2.  Handle the fragment identifiers myself: retrieve the URI, parse it,
use XPath (from xalan, say) on the the DOM, serialize the extracted schema
and reparse it into a caching grammar pool.  This is pretty
and there is probably some way I can optimize away the second parse.  Will
the grammar pool will be used even if the schemaLocation is not on the
external schemaLocations list?  Can some cached grammars  in a pool be
marked as permanent, while the others can be flushed to make room for new
ones?  Or is there a way to use two grammar pools, one for the permanent
grammars and the other for the transient (but potentially cached) ones?
  3.  Make a local filesystem copy (if not found in a standard location) of
the schema extracted from the wsdl and put it on the schemaLocation list.
This is fragile in the face of version upgrades of the WSDL file.

Has anyone a better idea, or advice about any of these approaches?

Jeff Greif
Webalo, Inc.

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

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

View raw message