File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML and java beans

 
druva singh
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using the JOX library to convert my XML file to java objects.
I need to validate this XML file before this object conversion takes place. Doing this with javax.xml.validation

Catch here is-
if there is a erroneous tag it needs to be overlooked as incomplete and not be converted to an object BUT BE SKIPPED. Other valid tags must be converted to objects

e.g. XML where id, name tags are both compulsory


<id>1
<name> abc
<address> abc-addr

<id>2
<name> pqr

<id>3

So, object with id = 3 must not be created but other objects must..

Any help would be appreciated!

Thanks!
 
Paul Clapham
Sheriff
Pie
Posts: 20166
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope. XML parsers aren't allowed to "fix" incorrect data, they are required to terminate when they reach the first error.

But you have well-formed XML, don't you? So you could write your own code to remove data which you deem to be incorrect.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic