From: Jeff M. <je...@mk...> - 2003-02-07 11:48:06
|
Cool, I was just adding this method to the validator ;-) public void useXMLSchema(boolean use) throws SAXException { parser.getXMLReader().setFeature( "http://xml.org/sax/features/validation",!use); parser.getXMLReader().setFeature( "http://apache.org/xml/features/validation/schema",use); parser.getXMLReader().setFeature( "http://apache.org/xml/features/validation/dynamic", use); } Thanks, for the feedback. Hope you hit a green bar soon. On Fri, 2003-02-07 at 11:08, Bonnet Emmanuel wrote: > I think I found it : > The features necessary for the SAX parser are not added in the case of XSD validation. > Here is the code I changed in the Validator Class to make it work. > I still have a problem later with the assertXMLEquals. > But now XmlUnit validates my files with XSD. > > ____________________________________________________________ > /** > * Baseline constructor: called by all others > * @param inputSource > * @param usingDoctypeReader > * @throws ParserConfigurationException > * @throws SAXException > */ > protected Validator(InputSource inputSource, boolean usingDoctypeReader) > throws ParserConfigurationException, SAXException { > isValid = null; > messages = new StringBuffer(); > SAXParserFactory factory = XMLUnit.getSAXParserFactory(); > factory.setValidating(true); > parser = factory.newSAXParser(); > this.validationInputSource = inputSource; > this.usingDoctypeReader = usingDoctypeReader; > > //---- EB modification > parser.getXMLReader().setFeature("http://xml.org/sax/features/validation", true); > parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/schema", ! usingDoctypeReader); > parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/dynamic", true); > > } > _________________________________________________________________________ > > > Hope this helps, > Emmanuel > > > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Xmlunit-general mailing list > Xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlunit-general -- Jeff Martin <je...@mk...> |