You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Wouter Coene <wo...@irdc.nl> on 2008/06/24 17:09:09 UTC

[PATCH] x2: Disabling automatic schema loading, and more schema validation

Hi,

I'm working on an application which is built against Xerces 2.8.0. This
application subclasses XMLGrammarPoolImpl to provide its own grammar caching
behaviour. In order to control this better it would be convenient if Xerces
would not automatically attempt to load schema grammars if they could not be
located in the grammar pool (as can already be controlled for DTDs).

The first attached patch (load-schema.patch) adds a new property on
SAX2XMLReader and DOMBuilder named XMLUni::fgLoadSchema[1], which controls
this behaviour. Is there a possibility of getting this in the next release
of Xerces?

Secondly, Xerces' SAX2XMLReader and DOMBuilder have a property
XMLUni::fgXercesSchemaFullChecking[2], which controls validation of schema
files themselves. However, even when this property is set, Xerces doesn't
validate the loaded schema files against its schemas. The second attached
patch (schema-checking.patch) should change this. Is the current Xerces
behaviour a bug?

Thanks,
Wouter Coene

[1]. Or "http://apache.org/xml/features/nonvalidating/load-schema"
[2]. Or "http://apache.org/xml/features/validation/schema-full-checking"

Re: [PATCH] x2: Disabling automatic schema loading, and more schema validation

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Wouter,

Wouter Coene <wo...@irdc.nl> writes:

> See attachment (load-schema2.patch) for a patch against Xerces-C's trunk as
> of this afternoon (SVN rev 671547).

Ok, your patch is in SVN. I've made a couple of changes (I don't think
your modifications to scanners were correct) so can you try it on your
application to make sure everything works as expected?


> I'm a bit uncertain of the changes in TraverseSchema though.

Yes, those changes were incorrect. We don't need to worry about
import/include since these will never be triggered once no-load
is set (that is, you first need to load a top-level schema which
is not possible except with an explicit loadGrammar call in which
case we want import/include to work).

Thanks for the patch!

Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

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


Re: [PATCH] x2: Disabling automatic schema loading, and more schema validation

Posted by Wouter Coene <wo...@irdc.nl>.
According to Boris Kolpackov (boris@codesynthesis.com):
> Wouter Coene <wo...@irdc.nl> writes:
> > The first attached patch (load-schema.patch) adds a new property on
> > SAX2XMLReader and DOMBuilder named XMLUni::fgLoadSchema[1], which controls
> > this behaviour. Is there a possibility of getting this in the next release
> > of Xerces?
> 
> This makes sense and I will commit your patch if you can do the following:
[snip]

See attachment (load-schema2.patch) for a patch against Xerces-C's trunk as
of this afternoon (SVN rev 671547).

I'm a bit uncertain of the changes in TraverseSchema though. Maybe someone
more familiar with that code should take a look at it.

Thanks,
Wouter Coene

Re: [PATCH] x2: Disabling automatic schema loading, and more schema validation

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Wouter,

Wouter Coene <wo...@irdc.nl> writes:

> The first attached patch (load-schema.patch) adds a new property on
> SAX2XMLReader and DOMBuilder named XMLUni::fgLoadSchema[1], which controls
> this behaviour. Is there a possibility of getting this in the next release
> of Xerces?

This makes sense and I will commit your patch if you can do the following:

- Make it against 3.0.0 since that will be the next release. Note that
  in 3.0.0 DOMBuilder was replaced with DOMLSParser. You can check out
  the current revision (trunk) by following the instructions on this
  page:

  http://xerces.apache.org/xerces-c/source-repository.html

- Provide documentation for your feature in the doc/ directory. You need
  to document it in every place where LoadExternalDTD is documented.


> Secondly, Xerces' SAX2XMLReader and DOMBuilder have a property
> XMLUni::fgXercesSchemaFullChecking[2], which controls validation of schema
> files themselves. However, even when this property is set, Xerces doesn't
> validate the loaded schema files against its schemas. The second attached
> patch (schema-checking.patch) should change this. Is the current Xerces
> behaviour a bug?

No, this is not a bug. There is no real schema for XML Schema (there is
one which is not valid and is for illustration only). Xerces-C++ does
manual validation of schemas so turning on XML Schema validation on
schemas does not make much sense.

Thanks,
Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

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