Board index » cppbuilder » Ahhh Help, Dynamic TXMLDocument

Ahhh Help, Dynamic TXMLDocument


2008-02-10 02:45:14 AM
cppbuilder32
Hi all, sorry about posting here but .xml newsgroup looks a bit dead.
I'm having a major problem, I need to read in and parse some XML within a
DLL. I intended to do this using a TXMLDocument althrough the DLL does not
have any TForm's or DataModules. Before i got started, I did a basic test,
dynamically creating an occurance of the TXMLDocument and it looked to work
i.e.
xmlDoc = new TXMLDocument("");
However, now that i try to load my XML, I keep getting Access Violation
Errors. I've tried assigning the DOMVendor and I've tried other load
functions i.e. LoadFromFile, LoadFromStram, LoadFromXML but all create AV's.
Has anyone come across this before? Does anyone know how i can resolve
this?
Many thanks in advance,
Mike C
 
 

Re:Ahhh Help, Dynamic TXMLDocument

Sorry - please ignore - i hadn't read the help properly. Quick search on
google showed up Remys explaination of using the NewXMLDocument().
All working now...
Sorry
 

Re:Ahhh Help, Dynamic TXMLDocument

"Mike Collins" <its@TheBottomOfThePost>wrote in message
Quote
Hi all, sorry about posting here but .xml newsgroup looks a bit dead.
It is not dead. There just aren't too many people asking XML questions in
general. But the group is still monitored nontheless.
Quote
I'm having a major problem
That is because you are not taking into account that TXMLDocument acts like
a reference-counted interface rather than an object when instantiated
dynamically. You should be using the IXMLDocument interface directly in
that situation, ie:
_di_IXMLDocument xmlDoc = NewXMLDocument();
// use xmlDoc as needed...
// the IXMLDocument is freed automatically when the
// xmlDoc variable goes out of scope...
_di_IXMLDocument xmlDoc = LoadXMLDocument("filename.xml");
// use xmlDoc as needed...
etc...
Gambit
 

{smallsort}