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

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to