Hi,
I'm trying to validate a XML file with a schema I wrote. I used the
following code to try out if my file works:
http://java.sun.com/developer/technicalArticles/xml/validationxpath/
For some reason, it only seems to work when my schema uses the default
namespace. When I change that to a custom namespace, the code doesn't
run.
I'm using Altova XML spy to make sure the schema file is valid, and
that doesn't complain.
Do I need to make some modifications to the code when trying to
validate with an XSD using custom namespaces?
Thanks
Rohit.
oulan bator - 27 Dec 2005 13:55 GMT
hi,
which namespace did you change ?
there is (as far as I read) no optional namespace in the example. Is it
in myDocument.xml ?
In this case you have to tell the parser to be namespace aware
setNamespaceAware on DocumentBuilderFactory
Piper707@hotmail.com - 29 Dec 2005 04:14 GMT
Thanks oulan. That fixed my problem. Should have figured that out.
The custom namespaces I used were in my own xsd, not the one on the
website.