This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JIBX validate the structure of input xml file before unmarsalling it?

 
dong zhang
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. The validation is mainly validate the structure of input xml file. I need to qulify whether the xml has a correct format for parsering.

2. Besides, I need to print the error message for the error elements in xml file.

I serach some method that use XSD to validate xml file. But, I don't know how to implement it.

Thanks.




 
kri shan
Ranch Hand
Posts: 1478
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JIBX does not support Schema validation. If you want strict Schema validation, then use JAXB / XML Beans data binding frameworks.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no reason you could not read the file twice, once for validation and then again with JIBX.

Check out the javax.xml.validation package.

Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic