Xerces release: Xerces 2.3.0

Problem:
I'm using the following code:

....
documentFactory.DocumentBuilderFactory.newInstance();
documentFactory.setAttribute(schemaLanguage, schemaNamespace);
documentFactory.setValidating(validate);
....


I keep reference to a document builder factory, and when I need to to create 
non-validating parser I simply call documentFactory.setValidating(false) before 
creating document builder.
When I need to create a validating parser I call 
documentFactory.setValidating(true) before creating document builder.

This worked fine with previous releases of Xerces.

When using with Xerces 2.3.0 an error is generated when parsing with
non-validating parser. The error referes to not defined root element, so even 
if 
validate is set to false, parser looks for a schema.

Why is so? 
I assume that this is because documentFactory has set schemaLanguage, and 
schemaNamespace attributes. I could not reset these attributes.  Can I do this? 
Any advice?

Creating a new document builder factory each time I want to create 
non-validating/validating parser is the only possible solution? I'm trying to 
improve performance and therefore I would prefer to keep reference to document 
builder factory if this is possible.

Any advise welcome.

Jan



 
 



Reply via email to