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
785 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 250 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
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 connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

756 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