New TXMLDocument in Borland C ++ Builder

Is it possible to create and destroy TXMLDocument on my own in Borland C ++ Builder? I've tried it, but borland keeps telling me that TXMLDocument is (and should be) an IDE driven component.

Also, the only reason I want to do this is because TXMLDocument is crashing: I get TXMLDocument and "Get" the workbook, sets some document properties (the xml is saved as an Excel file later), and I add some styles. Ok then I add the worksheet and then all the cells I want with correct formatting and then I save it. Everything is in order at the moment.

Then I want to save another Excel file. Since the IDE does not allow me to delete and recreate the TXMLDocument, I am trying to delete it in sheet form only. When I try to do this (in debug mode) the IDE goes into linear step mode in the CPU tab (shows some assembler):

ntdll.DbgBreakPoint:
77A07DFE CC               int 3
77A07DFF C3               ret

      

+1


source to share


2 answers


You need to do something like this:

_di_IXMLDocument Doc = NewXMLDocument(); 

      



I can't remember the details as to why, but it should point you in the right direction.

There's more information on the Codegear website here .

+2


source


Try the following:



#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 ))));
  }

      

0


source







All Articles