aspose file tools*
The moose likes XML and Related Technologies and the fly likes Howto validate xml schema? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Howto validate xml schema?" Watch "Howto validate xml schema?" New topic
Author

Howto validate xml schema?

Alan Mc Kernan
Ranch Hand

Joined: Oct 13, 2005
Posts: 59
Guys, I want to programatically validate xml schema files.. can someone point me in the right direction. I dont want to validate xml files against a schema, but moreso to validate the schema itself.

Cheers
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Isn't that supposed to be the beauty of schemas versus DTDs? If you know how to validate an xml document against a schema, do that to your schema document: validate myschema.xsd against schema http://www.w3.org/2001/XMLSchema.xsd
[ February 13, 2006: Message edited by: Jeff Albertson ]

There is no emoticon for what I am feeling!
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Write a schema to validate a schema, since a schema is an XML?


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Originally posted by Jeff Albertson:
Isn't that supposed to be the beauty of schemas versus DTDs? If you know how to validate an xml document against a schema, do that to your schema document: validate myschema.xsd against schema http://www.w3.org/2001/XMLSchema.xsd

[ February 13, 2006: Message edited by: Jeff Albertson ]


Hi Jeff,

I think Alan wanted to validate a schema rather than the actual XML data file. But if I'm mistaken, Jeff's way is correct.

Cheers!
Alan Mc Kernan
Ranch Hand

Joined: Oct 13, 2005
Posts: 59
Hrm, yeah that makes sense.

But what about sub files that the XSD imports/links to?

Basically Ill have a directory with a tree of XSD's, some have common elements which are contained in their own XSD and then the top level XSD's import those.

So basically I want to programically (or by some automated means) ensure that they are all valid. i.e there may be cases where the command element XSD's are missing.. or not valid for some reason.
Alan Mc Kernan
Ranch Hand

Joined: Oct 13, 2005
Posts: 59
This technique.. semi works. It will validate that the XSD is well formed, but when I remove an import, which is used in the schema, it still passes with no problems.

Anyone any ideas?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Howto validate xml schema?