Thread View: borland.public.cppbuilder.internet.web
10 messages
10 total messages
Started by Carlos Botto
Wed, 23 Feb 2005 20:13
Problems using TXMLDocument
Author: Carlos Botto
Date: Wed, 23 Feb 2005 20:13
Date: Wed, 23 Feb 2005 20:13
41 lines
2027 bytes
2027 bytes
Hi,
The code below belongs to a unit call Child.cpp, the Child.obj file is used
with others to create a DLL. I used the same piece of code in a single
application to test it and it worked well, but when I have an application
that uses the DLL I'm having the following error at the sentence "
XMLDocument->LoadFromFile((WideString)FileName);"
The error message is : "Exception EOleException in module xmlrtl60.bpl at
00082831"
And the code is :
void TChildFRM::ReadXMLFile(AnsiString FileName, XMLFileDescription
*FileDesc[])
{
int i;
AnsiString NodeName;
AnsiString Value;
_di_IXMLNode docRoot;
_di_IXMLNode docCurrentNode;
XMLDocument = new TXMLDocument("");
ParentNode.clear();
if(FileExists(FileName))
{
XMLDocument->LoadFromFile((WideString)FileName);
docRoot = XMLDocument->DocumentElement;
docCurrentNode = docRoot;
ParentNode[FileDesc[0]->GetNodeLevel()] = docCurrentNode;
Any ideas?
Thank you
Carlos
Re: Problems using TXMLDocument
Author: Remy Lebeau (TeamB)
Date: Wed, 23 Feb 2005 20:24
Date: Wed, 23 Feb 2005 20:24
35 lines
1772 bytes
1772 bytes
"Carlos Botto" <carlosb@qualitau.com> wrote in message
news:421ce3f0$1@newsgroups.borland.com...
> The error message is : "Exception EOleException in module
> xmlrtl60.bpl at 00082831"
Is that the whole message? There should have been a text message included
that described the reason for the error.
> XMLDocument = new TXMLDocument("");
Do not use TXMLDocument dynamically like that. TXMLDocument works
differently when instantiated dynamically. Use the IXMLDocument interface
via NewXMLDocument() and LoadXMLDocument() instead, ie:
void TChildFRM::ReadXMLFile(AnsiString FileName, XMLFileDescription
*FileDesc[])
{
_di_IXMLDocument XMLDocument;
//...
if( FileExists(FileName) )
{
XMLDocument = LoadXMLDocument(FileName);
//...
}
else
{
XMLDocument = NewXMLDocument();
//...
}
}
Gambit
Re: Problems using TXMLDocument
Author: Carlos Botto
Date: Wed, 23 Feb 2005 21:46
Date: Wed, 23 Feb 2005 21:46
70 lines
3016 bytes
3016 bytes
Remy,
Thank for your answer.
Yes this is the whole error message. The error window title is "Application
error".
I still have the error.
I had another problem linking the DLL, I got some "unresolved external"
errors:
[Linker Error] Unresolved external '__fastcall
Xmldoc::TXMLDocument::LoadFromFile(const System::WideString)' referenced
from Z:\GRAPH ENVIRONMENT\OBJECT\CHILD.OBJ
[Linker Error] Unresolved external '__fastcall
Xmldoc::TXMLDocument::GetDocumentElement()' referenced from Z:\GRAPH
ENVIRONMENT\OBJECT\CHILD.OBJ
[Linker Error] Unresolved external 'Xmldoc::TXMLDocument::' referenced from
Z:\GRAPH ENVIRONMENT\OBJECT\CHILD.OBJ
But I saw in another post that the solution for that was checking "Build
with runtime packages" in Options. Is that correct?
I have the feeling that both problems are related.
Thanks again
Carlos
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:421ce683@newsgroups.borland.com...
>
> "Carlos Botto" <carlosb@qualitau.com> wrote in message
> news:421ce3f0$1@newsgroups.borland.com...
>
> > The error message is : "Exception EOleException in module
> > xmlrtl60.bpl at 00082831"
>
> Is that the whole message? There should have been a text message included
> that described the reason for the error.
>
> > XMLDocument = new TXMLDocument("");
>
> Do not use TXMLDocument dynamically like that. TXMLDocument works
> differently when instantiated dynamically. Use the IXMLDocument interface
> via NewXMLDocument() and LoadXMLDocument() instead, ie:
>
> void TChildFRM::ReadXMLFile(AnsiString FileName, XMLFileDescription
> *FileDesc[])
> {
> _di_IXMLDocument XMLDocument;
> //...
> if( FileExists(FileName) )
> {
> XMLDocument = LoadXMLDocument(FileName);
> //...
> }
> else
> {
> XMLDocument = NewXMLDocument();
> //...
> }
> }
>
>
> Gambit
>
>
Re: Problems using TXMLDocument
Author: Remy Lebeau (TeamB)
Date: Wed, 23 Feb 2005 22:32
Date: Wed, 23 Feb 2005 22:32
20 lines
1547 bytes
1547 bytes
"Carlos Botto" <carlosb@qualitau.com> wrote in message news:421cf9a4$1@newsgroups.borland.com... > I had another problem linking the DLL, I got some > "unresolved external" errors: You did not make the changes I suggested. Those errors are still referencing to TXMLDocument. > But I saw in another post that the solution for that was > checking "Build with runtime packages" in Options. Is > that correct? If you do that, you will have to distribute additional BPL files along with your DLL. It sounds like you did not add the xmlrtl package to your project at all. That would account for the "unresolved external" errors. Gambit
Re: Problems using TXMLDocument
Author: Carlos Botto
Date: Wed, 23 Feb 2005 23:27
Date: Wed, 23 Feb 2005 23:27
41 lines
2516 bytes
2516 bytes
Remy, Sorry, I didn,t express myself very well. I tried your suggestions, but it diddn't work either. I'm now back to my original code wich use a TXMLDocument component, but in any way that I tried to implement it I always had problems running the application that uses the DLL. It's always the same error, that why I think it's related to my original problems linking the DLL. This is my first implementaion of XML with c++, can you suggest me some document to read where I can dive for this solutions? Thank you again Carlos "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:421d0494$1@newsgroups.borland.com... > > "Carlos Botto" <carlosb@qualitau.com> wrote in message > news:421cf9a4$1@newsgroups.borland.com... > > > I had another problem linking the DLL, I got some > > "unresolved external" errors: > > You did not make the changes I suggested. Those errors are still > referencing to TXMLDocument. > > > But I saw in another post that the solution for that was > > checking "Build with runtime packages" in Options. Is > > that correct? > > If you do that, you will have to distribute additional BPL files along with > your DLL. It sounds like you did not add the xmlrtl package to your > project at all. That would account for the "unresolved external" errors. > > > Gambit > >
Re: Problems using TXMLDocument
Author: Carlos Botto
Date: Wed, 23 Feb 2005 23:46
Date: Wed, 23 Feb 2005 23:46
59 lines
2451 bytes
2451 bytes
Remy,
My actual code is:
TXMLDocument *XMLDocument; //I'd drop the component on the Child form, wich
is a fsMDIChild.
void TChildFRM::ReadXMLFile(AnsiString FileName, XMLFileDescription
*FileDesc[])
{
int i;
AnsiString NodeName;
AnsiString Value;
_di_IXMLNode docRoot;
_di_IXMLNode docCurrentNode;
ParentNode.clear();
if(FileExists(FileName))
{
XMLDocument->LoadFromFile((WideString)FileName);
docRoot = XMLDocument->DocumentElement;
docCurrentNode = docRoot;
ParentNode[FileDesc[0]->GetNodeLevel()] = docCurrentNode;
Thanks
Carlos
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:421d0494$1@newsgroups.borland.com...
>
> "Carlos Botto" <carlosb@qualitau.com> wrote in message
> news:421cf9a4$1@newsgroups.borland.com...
>
> > I had another problem linking the DLL, I got some
> > "unresolved external" errors:
>
> You did not make the changes I suggested. Those errors are still
> referencing to TXMLDocument.
>
> > But I saw in another post that the solution for that was
> > checking "Build with runtime packages" in Options. Is
> > that correct?
>
> If you do that, you will have to distribute additional BPL files along
with
> your DLL. It sounds like you did not add the xmlrtl package to your
> project at all. That would account for the "unresolved external" errors.
>
>
> Gambit
>
>
Re: Problems using TXMLDocument
Author: Remy Lebeau (TeamB)
Date: Thu, 24 Feb 2005 00:07
Date: Thu, 24 Feb 2005 00:07
22 lines
1687 bytes
1687 bytes
"Carlos Botto" <carlosb@qualitau.com> wrote in message news:421d116d$1@newsgroups.borland.com... > Sorry, I didn,t express myself very well. I tried your > suggestions, but it diddn't work either. Why not? Just saying it doesn't work says nothing about the actual problem you are having. Always provide specific details. > I'm now back to my original code wich use a TXMLDocument component, As I already said earlier, you really should not create TXMLDocument instances dynamically. > but in any way that I tried to implement it I always had problems > running the application that uses the DLL. Why? Again, always provide SPECIFIC details. Gambit
Re: Problems using TXMLDocument
Author: Carlos Botto
Date: Thu, 24 Feb 2005 20:00
Date: Thu, 24 Feb 2005 20:00
118 lines
4641 bytes
4641 bytes
Remy,
I implemented your suggestions and I got the same error than with my
original code.
This code is in the Child.cpp unit and the call to this method is in
View.cpp, both units are used to build the DLL.
With your suggestion I had:
void TChildFRM::ReadXMLFile(AnsiString FileName, XMLFileDescription
*FileDesc[])
{
int i;
AnsiString NodeName;
AnsiString Value;
_di_IXMLNode docRoot;
_di_IXMLNode docCurrentNode;
_di_IXMLDocument XMLDocument;
ParentNode.clear();
if(FileExists(FileName))
{
XMLDocument = LoadXMLDocument((WideString)FileName);
docRoot = XMLDocument->DocumentElement;
docCurrentNode = docRoot;
ParentNode[FileDesc[0]->GetNodeLevel()] = docCurrentNode;
And the error "Exception EOleException in module xmlrtl60.bpl at
00082831" occurred at the LoadXMLFile sentence (the FileName variable has
the rigth value). The error window title is "Application Error" and there is
no more information about it
With my original code:
void TChildFRM::ReadXMLFile(AnsiString FileName, XMLFileDescription
*FileDesc[])
{
int i;
AnsiString NodeName;
AnsiString Value;
_di_IXMLNode docRoot;
_di_IXMLNode docCurrentNode;
ParentNode.clear();
if(FileExists(FileName))
{
XMLDocument->LoadFromFile((WideString)FileName);
docRoot = XMLDocument->DocumentElement;
docCurrentNode = docRoot;
ParentNode[FileDesc[0]->GetNodeLevel()] = docCurrentNode;
I got exactly the same error at the LoadFromFile sentence.
Also when I uncheck the ""Build with runtime packages option" I get the
following error when links the DLL:
With your code :
[Linker Error] Unresolved external '__fastcall Xmldoc::LoadXMLDocument(const
System::WideString)' referenced from Z:\GRAPH ENVIRONMENT\OBJECT\CHILD.OBJ
With my code:
[Linker Error] Unresolved external '__fastcall
Xmldoc::TXMLDocument::LoadFromFile(const System::WideString)' referenced
from Z:\GRAPH ENVIRONMENT\OBJECT\CHILD.OBJ
[Linker Error] Unresolved external '__fastcall
Xmldoc::TXMLDocument::GetDocumentElement()' referenced from Z:\GRAPH
ENVIRONMENT\OBJECT\CHILD.OBJ
[Linker Error] Unresolved external 'Xmldoc::TXMLDocument::' referenced from
Z:\GRAPH ENVIRONMENT\OBJECT\CHILD.OBJ
In Desing Packages I have installed the xmldocBCB6.bpl package, and I tried
to install xmlrtl60.bpl, but it complains saying: "Package
c:\Windows\System32\xmlrtl60.bpl can't be installed because it is not a
design time package." Are there any othe package that I should install?
Thank you
Carlos
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:421d1aa4$1@newsgroups.borland.com...
>
> "Carlos Botto" <carlosb@qualitau.com> wrote in message
> news:421d116d$1@newsgroups.borland.com...
>
> > Sorry, I didn,t express myself very well. I tried your
> > suggestions, but it diddn't work either.
>
> Why not? Just saying it doesn't work says nothing about the actual
problem
> you are having. Always provide specific details.
>
> > I'm now back to my original code wich use a TXMLDocument component,
>
> As I already said earlier, you really should not create TXMLDocument
> instances dynamically.
>
> > but in any way that I tried to implement it I always had problems
> > running the application that uses the DLL.
>
> Why? Again, always provide SPECIFIC details.
>
>
> Gambit
>
>
Re: Problems using TXMLDocument
Author: Remy Lebeau (TeamB)
Date: Thu, 24 Feb 2005 20:56
Date: Thu, 24 Feb 2005 20:56
27 lines
2304 bytes
2304 bytes
"Carlos Botto" <carlosb@qualitau.com> wrote in message news:421e3257$1@newsgroups.borland.com... > And the error "Exception EOleException in module xmlrtl60.bpl > at 00082831" occurred at the LoadXMLFile sentence (the FileName > variable has the rigth value). The error window title is "Application > Error" and there is no more information about it Have you tried running the DLL through the debugger to find out the exact exception message? EOleException should be providing a text message describing the reason for the exception, which the popup message is problebly stripping off. The only other thing I can think of is whether your DLL and/or application ever called CoInitialize() before loading and accessing the XMLDocument. By default, IXMLDocument uses the MSXML engine, when uses COM, so COM has to be initialized before MSXML can be used. > Also when I uncheck the ""Build with runtime packages option" > I get the following error when links the DLL: You never said whether you are adding the xmlrtl package to your project. I asked you about that earlier. Gambit
Re: Problems using TXMLDocument
Author: Carlos Botto
Date: Fri, 25 Feb 2005 21:26
Date: Fri, 25 Feb 2005 21:26
44 lines
2660 bytes
2660 bytes
Remy, Thanks for your help, the solution to the problem was the call to CoInitialized(). Thanks again Carlos "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:421e3f7e$1@newsgroups.borland.com... > > "Carlos Botto" <carlosb@qualitau.com> wrote in message > news:421e3257$1@newsgroups.borland.com... > > > And the error "Exception EOleException in module xmlrtl60.bpl > > at 00082831" occurred at the LoadXMLFile sentence (the FileName > > variable has the rigth value). The error window title is "Application > > Error" and there is no more information about it > > Have you tried running the DLL through the debugger to find out the exact > exception message? EOleException should be providing a text message > describing the reason for the exception, which the popup message is > problebly stripping off. > > The only other thing I can think of is whether your DLL and/or application > ever called CoInitialize() before loading and accessing the XMLDocument. By > default, IXMLDocument uses the MSXML engine, when uses COM, so COM has to be > initialized before MSXML can be used. > > > Also when I uncheck the ""Build with runtime packages option" > > I get the following error when links the DLL: > > You never said whether you are adding the xmlrtl package to your project. I > asked you about that earlier. > > > Gambit > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads