• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XSD Validation using DOMSource isn't working in Java6

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've written an application that checks if an XSD file is valid.
In Java 5 everything is ok but in Java 6 there seems to be a problem.

It seems that if SchemaFactory.newInstance.newSchema is provided with DOMSource, then the validation is valid, even if the DOM is invalid.
To be more specific the first time the DOM is validated, if the DOM is invalid, it notifies that it is invalid,
but the rest of the times the validation seems to think that the DOM is valid.

If newSchema is provided with File then there's no problem.

Any help would be appreciated
Thank you



Sample XSD (invalid)


 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Damon. Welcome to The Ranch! Your post would be much easier to read if you UseCodeTags, so I've added them for you.
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On this matter, it is important to know which dom parser (builder/factory) the application is actually in use. Different implementation entails slightly different setup to make it work and/or simply unsupporting re-validation of loaded dom tree. Could you check that first and post the finding? You may use getClass().getName() to discover what implementation is actually in use.
reply
    Bookmark Topic Watch Topic
  • New Topic