From: Tim B. <t_j...@ya...> - 2003-02-10 20:46:00
|
FYI The original intent of the validator class was to allow validation against DTD 'A' to be performed when the XML content refers to DTD 'B'. Thanks for the feedback, Tim Jeff Martin wrote: >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 >> >> __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com |