Question

Is it possible for me to create and destroy a TXMLDocument by myself in Borland C++ Builder? I've tried but borland keeps telling me that TXMLDocument is (and must be) an IDE managed component.

Also, the only reason that I want to do this is that TXMLDocument sort of crashes: I get the TXMLDocument and 'Gets' a workbook from it, sets some document properties (the xml is saved as an Excel-file later), and the I add some styles. Ok, then I add a worksheet and then all the cells that I want with proper formatting and then I save it. At this point everything is OK.

Then I want to save another Excel-file. Since the IDE doesn't let me delete and recreate the TXMLDocument I try to delete just the worksheet form it. When I try this (in debug mode) the IDE goes in to line step mode in the CPU tab (showing some assembler):

ntdll.DbgBreakPoint:
77A07DFE CC               int 3
77A07DFF C3               ret
Was it helpful?

Solution

You need to do something like this instead:

_di_IXMLDocument Doc = NewXMLDocument(); 

I can't remember the gory details of why, but that should point you in the right direction.

There's more info on the Codegear website here.

OTHER TIPS

Try this :

#include <oxmldom.hpp>
#include <XMLDoc.hpp>
#include <xmldom.hpp>
#include <XMLIntf.hpp>


  try
  {
   CoInitialize(0);
   _di_IXMLDocument xmlDoc;
    xmlDoc = LoadXMLData( s1 );
   s1 = xmlDoc->XML->Text;
   CoUninitialize();
   mylog( Fun + String::Format( "ANSW-MSG-XML %s ", ARRAYOFCONST(( s1 ))));
  }
  catch ( Exception & ex )
  {
   mylog( Fun + String::Format( "PARSEXML:ERRORE %s \nmsg:%s",
      ARRAYOFCONST(( ex.Message, cmdMsg ))));
  }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top