[
Lists Home |
Date Index |
Thread Index
]
I have some existing code that uses the Xerces C++ parser. I want to add
the MSXML parser support to the code. However I do not want to implement
the parsing again, and would like to add a check at the higher level (if
MSXML, use MSXML parser , else use Xerces). Now since MSXML says it is DOM
compliant, I would guess that I should be easily able to get the DOM_Node
class (and other classes) from the MSXML parser.
But this is not the case, since MSXML is implemented as a COM server, all I
can get at is IXMLDOMNode. The problem is that now I will have to
implement all the parsing logic again ( I basically parse XML file, create
objects , based on the type of object e.g. if DOM_Node is of type Element,
create XYZ class , else create abc class etc., put the whole hierarchy in
memory , if I use MSXML , I will have to check node type IXMLDOMNode etc.).
The problem I run into here is that MSXML returns IXMLDOMNode, while Xerxes
returns DOM_Node, so I cannot use the same logic with the two parsers. I
will have to have a lot of if/else blocks OR have different classes for
each parser i.e MyApplicationXercesHeirarchyCreator,
MyApplicationMSXMLHeirarcyCreator......
It would be nice if I could just get the DOM_Node directly from MSXML
(instead of IXMLDOMNode), so that I can keep using the common parsing code.
Is there a way I can do this?
All suggestions appreciated!!!
Kundan.
|