Article View: borland.public.cppbuilder.internet.web
Article #1089Re: TXMLDocument - Access violation
From: nikhil
Date: Tue, 03 May 2005 10:14
Date: Tue, 03 May 2005 10:14
65 lines
3547 bytes
3547 bytes
Hi Gambit.
Thanks, here is the EXTRACT of my code that's generating error
void CheckReply()
{
tagVARIANT Opt,Ui;
int AttCnt;long Status;
WideString Cmd(String("SaveAs"));
WideString Domain,CharSet;
IHTMLDocument2 *HTMLDocument = NULL;
TXMLDocument *XmlDoc;
bool Success;
Status=MyBrowser->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&HTMLDocument);
if(Status!=0){ShowMessage("Could Not Read Response");return;}
HTMLDocument->get_domain(&Domain);
if(Domain==SetDom) //if the page loaded is from the domain predefined as SetDom
{
StatusPanel->Lines->Add(Domain); //Just for visual confirmation
StatusPanel->Lines->Add("Remote Service");
Opt.vt=VT_BSTR; Opt.bstrVal=WideString(SName); //SName is the generated file name with .txt extension
VARIANT_BOOL UI=VARIANT_FALSE;
VARIANT_BOOL __RPC_FAR RetVal;
//Saving the file
Status=HTMLDocument->execCommand(Cmd,UI,Opt,&RetVal); //I am having problem with this call also since it is not avoiding the save as dialogue box which I wish to
//creating TXMLDocument object dynamically out here.
XmlDoc=new TXMLDocument(TName);
//TName is the string variable holding the path and file name of xml file to be loaded.
XmlDoc->Options<<doNodeAutoCreate;
XmlDoc->Options<<doAttrNull;
XmlDoc->Options<<doAutoPrefix;
XmlDoc->Options<<doNamespaceDecl;
XmlDoc->NodeIndentStr=" ";
//XmlDoc->DOMVendor=
//XmlDoc->LoadFromFile(TName);
XmlDoc->Active=true;
ShowMessage(XmlDoc->XML->GetText());
//this message box successfully shows the contents of xml file loaded this suggest that the XmlDoc is not null
//however this next statement to retrieve the tagname generates the access violation.
TagName=XmlDoc->DocumentElement->GetNodeName();
if(TagName==WideString("Reply")) {
StatusPanel->Lines->Add(TagName);
StatusPanel->Lines->Add("Reading Reply"); }
else {
StatusPanel->Lines->Add("Error");
StatusPanel->Lines->Add("Invalid Reply");
return; }
}
Please check out whether it gives any insight to my problem and revert back.
Thank you again.
Technical Details
Message-ID:
<42774efe$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<427710ee$1@newsgroups.borland.com> <4277208b$3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,5ec60bdd5a7fae56 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "nikhil" <nikhilbatooni@yahoo.com> Sender: "nikhil" <nikhilbatooni@yahoo.com> Reply-To: "nikhil" <nikhilbatooni@yahoo.com> Subject: Re: TXMLDocument - Access violation Newsgroups: borland.public.cppbuilder.internet.web X-User-Info: 203.115.94.242 References: <427710ee$1@newsgroups.borland.com> <4277208b$3@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <42774efe$1@newsgroups.borland.com> Date: 3 May 2005 03:14:22 -0700 X-Trace: newsgroups.borland.com 1115115262 207.105.83.66 (3 May 2005 03:14:22 -0700) Lines: 65 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail