|
From: Stefan B. <bo...@ap...> - 2011-02-27 07:12:39
|
On 2011-02-25, Miguel wrote:
> - 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.
> 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).
At first I thought you'd have to use the URIResolver but this one is
explicitly only about includes and document() so I don't think it will
affect the resolution of DOCTYPEs.
The only way you could do it with JAXP and not XMLUnit is likely by
setting the EntityResolver on a DocumentBuilder, load the stylesheet
using this and pass it into the transformation as a DOMSource.
In fact this should work with XMLUnit as well (using the control builder
that you have already configured to use your EntityResolver):
Document myControlDocument = XMLUnit.buildControlDocument(myControlXML);
Document myStyleSheet = XMLUnit.buildControlDocument(new File("src/test/resources/nodeRemover.xsl"));
Transform myControlTransform = new Transform(new DOMSource(myControlDocument),
new DOMSource(myStyleSheet));
Stefan
|