tags:

views:

209

answers:

1

I'm using IXMLDOM in MSXML 6 to build an XML file in a C++ MFC application. Is there a way to see the contents of the xml document while it is in memory?

For example, an XPATH query is failing about halfway through creating the file. How would I view the entire contents of the xml doc?

Thanks!

+3  A: 

IXMLDOMElement derives from IXMLDOMNode, and IXMLDOMNode has an xml property that you can use to get the textual representation of the XML in memory.

IXMLDOMElementPtr spElement = ...;
_bstr_t xmlContents = spElement->xml();

If you're looking for a way to see the contents of the XML in the debugger without changing existing code to add this call, that may be possible, but I'm not exactly sure where to look.

Matt Dillard
A solution for the debugger is what I'm hoping for...but thanks for the code tip, that's perfect.
Steve Duitsman