Thread View: borland.public.cppbuilder.internet.web
2 messages
2 total messages
Started by Adam Griffin
Fri, 13 Aug 2004 16:45
TXMLDocument
Author: Adam Griffin
Date: Fri, 13 Aug 2004 16:45
Date: Fri, 13 Aug 2004 16:45
21 lines
1658 bytes
1658 bytes
The Following code works fine when the TXMLDocument component is placed
directly on the form, however the code throws an EAccessViolation when
TXMLDocument is instantiated at runtime. I instantiate TXMLDocoment as
follows: TXMLDocument* XMLDocument1 = new TXMLDocument("");
XMLDocument1->LoadFromFile(WideString("http://oconee.itron.com/scripts/ocn-e
x40.wsc/w1_mf073.p?part=980090000-000"));
_di_IXMLNode Part = XMLDocument1->DocumentElement->ChildNodes->GetNode(0);
for(int i=0;i<Part->ChildNodes->Count ;i++){
if(Part->GetHasChildNodes()) {
_di_IXMLNode part1=Part->ChildNodes->GetNode(i);
Memo1->Lines->Add("~p" + part1->GetAttribute(WideString("number")) +
"=\"" + part1->GetAttribute(WideString("description")) + "\"");
}
}
Can someone provide me with help?
Thanks,
atg
Re: TXMLDocument
Author: Remy Lebeau (TeamB)
Date: Fri, 13 Aug 2004 17:12
Date: Fri, 13 Aug 2004 17:12
36 lines
2173 bytes
2173 bytes
"Adam Griffin" <adam.griffin@itron.com> wrote in message
news:411cf085$2@newsgroups.borland.com...
> The Following code works fine when the TXMLDocument
> component is placed directly on the form, however the code
> throws an EAccessViolation when TXMLDocument is instantiated
> at runtime. I instantiate TXMLDocoment as follows:
> TXMLDocument* XMLDocument1 = new TXMLDocument("");
You should use the IXMLDocument interface instead, via the NewXMLDocument()
function. Don't instantiate TXMLDocument directly:
_di_IXMLDocument Doc = NewXMLDocument();
Doc->LoadFromFile("http://oconee.itron.com/scripts/ocn-ex40.wsc/w1_mf073.p?p
art=980090000-000");
_di_IXMLNode DocElement = Doc->DocumentElement;
if( (DocElement) && (DocElement->HasChildNodes) )
{
_di_IXMLNode Part = DocElement->ChildNodes->Nodes[0];
if( (Part) && (Part->HasChildNodes) )
{
for(int i = 0; i < Part->ChildNodes->Count; ++i)
{
_di_IXMLNode part1 = Part->ChildNodes->Nodes[i];
if( part1 )
Memo1->Lines->Add("~p" + part1->Attributes["number"] +
"=\"" + part1->Attributes["description"] + "\"");
}
}
}
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