?
Solved

I use TCppWebBrowser to POST data and receive the resulting page BUT if the result is XML this doesn't work ?

Posted on 2004-09-15
5
Medium Priority
?
797 Views
Last Modified: 2013-11-17

  if (!(!pCppWebBrowser->Busy && pOutputStrings && pCppWebBrowser->Document &&
          String(pCppWebBrowser->LocationURL) != String("about:blank") &&
          SUCCEEDED(pCppWebBrowser->Document->QueryInterface(
          IID_IHTMLDocument2, (LPVOID*)&HTMLDocument))))
   {
      BrowserStatus=BROWSER_NOT_READY;
   }
   else
   {


      // Following DOES NOT WORK in case the result is XML !????? Any idea why ??

      // Page has been loaded, now extract the content of the file
      if(SUCCEEDED(HTMLDocument->QueryInterface(IID_IPersistFile,(LPVOID*)&PersistFile)))
      {
         // Save the file content to a temporary file
         PersistFile->Save(WideString(TempFile),false);
         PersistFile->Release();
      }


     // OR ... another approach ...
     // WHICH ALSO doesn't work :


     IHTMLElement *HTMLBody = NULL;

        if(SUCCEEDED(HTMLDocument->get_body(&HTMLBody)) && HTMLBody)
        {
            BSTR HTMLSource;
            if(HTMLBody && SUCCEEDED(HTMLBody->get_outerHTML(&HTMLSource)))
            {
                TMemo *Memo = new TMemo(BrowserParentForm) ;
                Memo->Text = WideString(HTMLSource);
                Memo->Lines->SaveToFile(TempFile) ;

 .....


Above code works great if the data is html for instance but if the result is XML then Getting the body or persistfile fails ?

Any ideas ???

0
Comment
Question by:cybergonzo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 16

Expert Comment

by:George Tokas
ID: 12073550
I think that you need an XMLDocument component.
If you use BCB6 there is one under the internet tab. In Pro version I use there is one.
In BCB5 you have to add it manually as component.

gtokas.
0
 

Author Comment

by:cybergonzo
ID: 12073679
Via another post (newsgroups) I have been advised to use NMHTML as component, which I'm checking out now.
It may not be (properly) doable with pCppWebBrowser anyway (?)
0
 
LVL 16

Accepted Solution

by:
George Tokas earned 1000 total points
ID: 12074422
TCppWebBrowser is a wrapper around internet explorer and communicates via OLE.
NMHTML is a component wrapper around HTML and tcp/ip. It supports POST. I think you can understand the difference. The document body you can display with TCppBrowser is stored at NMHTTP->Body property.
Both can work I think with what you want.

gtokas.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question