This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Validate xml and separate the valid and invalid data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Validate xml and separate the valid and invalid data" Watch "Validate xml and separate the valid and invalid data" New topic
Author

Validate xml and separate the valid and invalid data

John Dealgan
Greenhorn

Joined: Feb 05, 2013
Posts: 1
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

Joined: Aug 07, 2007
Posts: 2332
    
  50
Welcome to the Ranch.

I think this would be better off in the XML forum so I'm moving it for you.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18712
    
    8

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.
 
 
subject: Validate xml and separate the valid and invalid data