Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

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?
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic