Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

XSD validation with custom namespaces ?

Thread view: 
Piper707@hotmail.com - 27 Dec 2005 03:39 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.