Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validate xml and separate the valid and invalid data

 
John Dealgan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to validate xml against its schema using SAX. How to extract the valid data into a "valid xml file" and invalid data into "invalid xml file". Any suggestions or code samples?
 
Tony Docherty
Bartender
Posts: 2941
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

I think this would be better off in the XML forum so I'm moving it for you.
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That isn't how validation by schema works. All you get from that is "OK" or "Not OK, here's why".

And anyway it's quite unlikely that the set of nodes rejected by the schema is going to be a well-formed XML document. Even if the schema did proceed beyond the first invalid node, which it doesn't.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic