File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes how to find schema of an xml from dom program at run time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to find schema of an xml from dom program at run time" Watch "how to find schema of an xml from dom program at run time" New topic
Author

how to find schema of an xml from dom program at run time

anish reddy
Ranch Hand

Joined: Apr 19, 2008
Posts: 74
hi

i want to validate xml according to schema using dom/xom parser.at run time user passes xml and schema to be validated.
but how to find schema passed by user is correct one that is being used by xml.

i have written a program to validate xml according to schema.

but iam facing problem when user passes wrong schema that is not used by xml ,which validate xml.


please give inputs to resolve this problem.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

You're asking "Given an XML document, how can I find a schema against which it will validate successfully?" Of course there is no possible answer to that, except perhaps to produce a schema which allows all documents as valid.

If you ask the user, and the user tells you the wrong schema, then the document will be invalid. There is no way you can distinguish this case from the case where the user tells you the right schema but the document is not valid according to that schema. It's up to the user to figure out what's going on in that case, not the programmer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to find schema of an xml from dom program at run time