On 5/18/07, Huw Davies huw@codeweavers.com wrote:
On Thu, May 17, 2007 at 04:40:06PM -0500, James Hawkins wrote:
Changelog:
- Add initial implementations of IXMLElement and IXMLElementCollection.
I can't help thinking that it would have been cleaner to implement the IXML stuff using the IXMLDOM interfaces rather than straight on top of libxml. That way we only get one set of interfaces that depend on libxml. It may not be possible, but I think it would be worth a look.
I've taken a look, and I don't think it's possible. Here is a 1-to-1 matching of methods in IXMLDocument and IXMLDOMDocument, respectively:
xmldoc_get_root => domdoc_documentElement xmldoc_get_fileSize xmldoc_put_fileModifiedDate xmldoc_get_fileUpdatedDate xmldoc_get_URL => domdoc_get_url xmldoc_put_URL => domdoc_load xmldoc_get_mimeType xmldoc_get_readyState => domdoc_get_readyState xmldoc_get_charset xmldoc_put_charset xmldoc_get_version xmldoc_get_doctype => domdoc_get_doctype xmldoc_get_dtdURl xmldoc_createElement => domdoc_createElement
The rows with empty second columns have no matching IXMLDOMDocument method, and more precisely, can't be implemented without access to xmlDoc/NodePtr. The file* methods aren't as simple as that, but either way, they don't involve libxml2. Another problem is the discrepancies between the interface implementations. For example, IXMLDocument::get_tagName returns the name of the tag in all upper-case, while IXMLDOMDocument's equivalent method preserves the case of the tag name. The Media Player 9 requires this behavior.
I understand your concerns about limiting use of libxml2, but I think that the limitation can only apply to the respective groups of interfaces, e.g., XMLDocument and co. vs. XMLDOMDocument and co. The latest version of each interface implements the interface using libxml2, and each earlier version is implemented on top of the latest version.