|
From: miguel <mi...@al...> - 2011-03-05 13:12:22
|
Hi Stefan,
On Sun, 2011-02-27 at 08:12 +0100, Stefan Bodewig wrote:
>
> 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));
>
This is exactly the way to go.
Loading the stylesheet this way will use our own EntityResolver. Thanks
a lot for the information, which saved me hours of desperate search for
the answer!
Miguel
|