Well, it turned out that my ideas are not really that big or even
complex.

I want a single unified type to represent any type of XML data that
any part of XMLUnit2 deals with - where any part is the difference
engine, the validator or the XPath engine.  XMLUnit 1.x has many
overloads with Document, String, InputStream and InputSource
parameters and this doesn't really help.

Together with this unified type we'd need adapters and maybe a
convenient fluent builder.

For Java it turns out such a unified type already exists:
javax.xml.transform.Source which is used by JAXP's validation API (and
transformations, obviously) and can be used by JAXP's XPath API in a
simple way via SAXSource.sourceToInputSource.  The only piece that may
be a bit more complex to implement would be the difference engine but
we can always perform an identity transform with a DOMResult as
target.  The same is true for XPath and a SAXResult.

org.xml.sax.InputSouce could be a choice that would be almost as
compelling, but it looks as if Source was the way forward in JAXP
given the validation API and StAXSource in the newer versions.

.NET doesn't really have a type like this.  XmlReader probably gets
closest but it's a class rather than an interface which may constrict
some things we'd like to do.

I propose to use something like

public interface ISource {
    XmlReader Reader {get;}
}

instead and implement that for XmlDocument, Stream and TextReader.
The XMLUnit2 APIs would then look similar in that they'd use
(I)Source.

The builder I envision is somethng along the lines of

Input.fromFile("some/path").withEntityResolver(someResolver).build();

Comments?

Stefan

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Xmlunit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xmlunit-general

Reply via email to