Hi All,

I'm writing some code to validate a series of documents against a
schema.

These documents have a root node with no namespace, and no schema
declaration within the document, eg

 <root>
   <stuff/>
 </root>

I preload the required schema into the SAX2XMLReader class using
"loadGrammar". It works fine when the schema has a targetNamespace and
the root element of the input xml has a namespace, eg I can process this
fine:
 <base:root xmlns:root="zzzz">
   <stuff/>
 </base:root>
with a (preloaded) schema whose targetNamespace="zzzz".

If I preload a schema with no namespace into a SAX2XMLReader instance, I
can successfully retrieve it with
  parser.getGrammar(XMLString::transcode(""))
so it appears loaded ok.

But then parsing xml like:
 <root>
   <stuff/>
 </root>
simply reports "unknown element 'root'".

The noNamespaceSchemaLocation property doesn't seem to do what I want;
that allows me to specify the SystemId value of a schema - but the
schema is already loaded into the parser.

Any ideas how I can get the parser to use the preloaded schema with no
target namespace to validate a root element with no declared namespace?

Thanks,

Simon

PS: Sorry for posting to the dev list. I can't see a user list
anywhere...


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to