This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validate on the fly

 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am building a XML document on the fly and want to validate the document before storing the file in the database. But when I try to validate it using saxBuilder I got an error even that I know the XML document is alright.

org.jdom.input.JDOMParseException: Error on line 2: cvc-elt.1: Cannot find the declaration of element 'Invoice'.

It seems that something goes wrong when validating the ByteArray:
Document d = saxBuilder.build( new ByteArrayInputStream( buff ) );

Can you help me correct the code?

 
Paul Clapham
Sheriff
Pie
Posts: 20946
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks to me like your document uses a schema, but the parser can't find the schema. Have a look at where the document points to the schema.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic