• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Howto validate xml schema?

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Write a schema to validate a schema, since a schema is an XML?
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic