[please keep the list in CC so that the answers get archived]
> I have written a class implementing EntityResolver with the
> following method:
looks good at first glance.
> And my testcase looks like the following: My aim is to compare testf
> with controlf and the dtd (InfoSettlementResponse.dtd) resides in
> the same directory as the xml files.
If you are using XMLUnit 1.1 beta, simply use
XMLUnit.setControlEntityresolver and XMLUnit.setTestEntitiyResolver
and then invoke assertXMLEquals or Diff just as you did in your first
code examples.
Alternatively you (should work in 1.0 as well) can parse the XML files
yourself, while setting the EntityResolver, something like
> File controlf = new File("C:/Program
> Files/xmlunit/tests/etc/InfoSettlementResponse_control.xml");
>
> DocumentBuilder dbCon = XMLUnit.getControlParser();
> OmgeoDTDEntityResolver er = new OmgeoDTDEntityResolver();
> dbCon.setEntityResolver(er);
Document docCon = dbCon.parse(new InputSource(new
FileInputStream(controlf)));
andd similar for the test document. I.e. you parse your document
under the control of the EntityResolver. The parser's going to call
back on your resolver when it encounters the DTD's public identifier.
See the jaxp docs for more details.
After you have Document instances you can use the Diff constructor
that accepts org.w3c.dom.Document as arguments.
Stefan
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general