Validating xml against schema in java Chat with sexy moms
I had the same issue when I was programming a project for Android. I found that I had to use Xerces-for-Android to solve my problem. I have managed to use a Validation Event Collector to handle events, which works for XML parsing errors such as mismatched tags but doesn't raise any events when there is a tag that is required but is completely absent.From what I have seen validation can be done againsta schema, but you must know the path to the schema in order to pass it into the set Schema() method.This is the Java code I have so far, which seems to only do XML validation, not schema validation: OK, I've found the solution.Using the schema factory to create a schema, but without specifying a schema file makes it work with the no Namespace Schema Location specified in the XML file.Now if, as you say, includes b.xsd, and includes a.xsd, then there's no need to load all three into the schema factory. Not only is it unnecessary, it will likely confuse Xerces and result in errors, so this may be your problem.
try catch (SAXException e) catch (IOException ex) class Validator extends Default Handler Remember to change: 1) The parameter " for you xsd file location.So the code from above has had this added: Schema Factory factory = Schema Instance(" Schema schema = Schema(); Unmarshaller unmarshaller = jc.create Unmarshaller(); Schema(schema); m_dds Settings = (com.ultra.