From: Miguel <mi...@al...> - 2011-02-25 19:34:03
|
Hi, Consider the following scenario: - I am using XMLUnit on a set of legacy files with different SYSTEM definitions in DOCTYPE. Some of them are invalid (the web address changed in real life). Because I had ceated my own EntityResolver to resolve to a local file, I decided to use it. The following lines work: XMLUnit.setControlEntityResolver(entityResolver ); //My own implementation of EntityResolver XMLUnit.setTestEntityResolver(entityResolver ); Document myControlDocument = XMLUnit.buildControlDocument(myControlXML); //OK, calls my EntityResolver in the process. all is well Document myTestDocument = XMLUnit.buildTestDocument(myTestXML); Document myControlDocument =myControlTransform.getResultDocument(); Document myTestDocument =myTestTransform.getResultDocument(); XMLUnit.compareXML(myControlDocument,myTestDocument); Now, the problem comes when I try to apply a transformation to one of the documents: Transform myControlTransform = new Transform(myControlXML, new File("src/test/resources/nodeRemover.xsl")); This code doesn't seem to use my EntityResolver, but tries to resolve the internet address (it doesn't work). So when I call myControlTransform.getResultDocument(); I get an empty document instead of the correct one. My questions are: a) how can I use my EntityResolver with Transform and Transformers? b) Is it possible to use our own EntityResolver with XMLUnit.getTransformerFactory()? How? Thank you very much for your replies, Miguel Almeida |