From: Jeff M. <je...@mk...> - 2003-02-11 10:18:53
|
Just out of interest why would you want to do that? We should probably add this method to XMLUnit as well to allow tests to be performed against an XSD. Is there a way to assert that a document has a reference to a DTD or XSD? On Mon, 2003-02-10 at 20:48, Tim Bacon wrote: > 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 > > > ------------------------------------------------------- > 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...> |