XSD validation with custom namespaces ?

P

Piper707

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.
 
O

oulan bator

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
 
P

Piper707

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top