Solved

get xml information using webbrowser control

Posted on 2002-05-10
15
717 Views
Last Modified: 2012-06-27
I am using a webbrowser control in vb6 and I want to get the xml information from it.  If I use view source on the web page I can see the xml information but when I put the html information into a text box the xml information is not there.
0
Comment
Question by:rjef
  • 5
  • 4
  • 3
  • +3
15 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7003864
How do you get source code?

try:
' in document_complete event of webbrowser

debug.print webbrowser.document.documentelement.innerhtml
0
 

Author Comment

by:rjef
ID: 7003927
It doesn't give the same results as right click 'select all' then 'copy' then 'paste' into notepad. This is really what I want. It looks like it is giving the xml commands but not the data from the commands.
0
 
LVL 15

Expert Comment

by:robbert
ID: 7004766
There seems to be no way to use the Webbrowser control to get the underlying XML source.
You need to retrieve the original XML file.
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7004777
"It doesn't give the same results as right click 'select all' then 'copy' then 'paste' into notepad.

..."
Sorry, i don't understand, you did never talk about copy/paste stuff. Your primary question was:
".  If I use view
source on the web page I can see the xml information but when I put the html information into a text
box the xml information is not there. "
0
 
LVL 15

Expert Comment

by:robbert
ID: 7004786
XML in IE is converted to that syntax-highlighted HTML when displayed.

So it is:
webbrowser.document.documentelement.innerTEXT
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7004799
Well, what we need here, html code or pure text contents?
0
 
LVL 15

Expert Comment

by:robbert
ID: 7004818
pure text = xml
0
 

Author Comment

by:rjef
ID: 7005014
Ok lets stick with 'I need the same as view source'
The innertext does not give the same as view source.
The innerhtml does not give the same as view source
The selectall and copy does not give the same as view source

example innerhtml
<TD class=fm24 style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none" colSpan=3>Carrier</TD></TR></TBODY></TABLE></TD>
<TD class=fm26 style="BORDER-RIGHT: #999999 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #999999 1px solid; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; BORDER-LEFT: #999999 1px solid; PADDING-TOP: 0px; BORDER-BOTTOM: #999999 1px solid">
<TABLE class=fm26 style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>


example innertext
19598783471203248663669PS80-02-F0778NULLNULLNULL5023-Apr-02 06:00 AM20-APR-2002YORK INTERNATIONAL S.A. DE C.VUPS NEXT DAYPA23-APR-2002
295989217112125776730104391-8-365..269NULLNULLNULL10006-May-02 08:00 PM26-APR-2002PARKER HANNIFIN CORPORATIONUPS GRNDOP06-MAY-2002

example viewsource
td class="fm31">663669</td><td class="fm32">PS80-02-F0778</td><td class="fm33">NULL</td><td class="fm34">NULL</td><td class="fm35">NULL</td><td class="fm36">50</td><td class="fm37">23-Apr-02 06:00 AM</td><td class="fm38">20-APR-2002</td><td class="fm39">YORK INTERNATIONAL S.A. DE C.V</td><td class="fm40">UPS NEXT DAY</td><td class="fm41">PA</td><td class="fm42">23-APR-2002</td></tr><tr><td class="row_number_cell">2</td><td class="fm29">959892171</td><td class="fm30">1212577</td><td class="fm31">673010</td><td class="fm32">4391-8-365..269</td><td class="fm33">NULL</td><td class="fm34">NULL</td><td class="fm35">NULL</td><td class="fm36">100</td><td class="fm37">06-May-02 08:00 PM</td><td class="fm38">26-APR-2002</td><td class="fm39">PARKER HANNIFIN CORPORATION</td><td class="fm40">UPS GRND</td><td class="fm41">OP</td><td class="fm42">06-MAY-2002</td></tr><tr><td class="row_number_cell">3</td><td

example
'selectall'  'copy'
1 959878347 1203248 663669 PS80-02-F0778 NULL NULL NULL 50 23-Apr-02 06:00 AM 20-APR-2002 YORK INTERNATIONAL S.A. DE C.V UPS NEXT DAY PA 23-APR-2002
2 959892171 1212577 673010 4391-8-365..269 NULL NULL NULL 100 06-May-02 08:00 PM 26-APR-2002 PARKER HANNIFIN CORPORATION UPS GRND OP 06-MAY-2002

If I could get the viewsource example the data I need is between the '>' '<'
0
 
LVL 15

Expert Comment

by:robbert
ID: 7007261
> <TD class=fm26 style="BORDER-RIGHT: #999999 1px solid;

Note: This doesn't look like XML at all, and it doesn't look like XML automatically converted to HTML by IE.

What is WebBrowser1.LocationURL?
0
 

Author Comment

by:rjef
ID: 7007516
It is an internal website
0
 
LVL 15

Expert Comment

by:robbert
ID: 7009490
What do you mean by,

>  I want to get the xml information from (an HTML document)

and what's the difference between an "internal" and an "external" website, regarding your question?
This is not a very clear question, try to make it clear or it's lost :-)
0
 

Author Comment

by:rjef
ID: 7010018
What I want to be able to get using the webbrowser control is the exact same information I get when I use the view>source option in the Internet Explorer.  I thought it was xml but I guess it is not.
The web site is internal to our company (behind a firewall)  I think it could also be called the intranet.

0
 
LVL 23

Accepted Solution

by:
b1xml2 earned 200 total points
ID: 7039799
the problem rjef is this.

whenever you obtain a snapshot of the underlying data via the web browser control thru VB Code, you see the actual state of the DOM. This is not true with viewing the source via the Browser itself. Here the DOM may be re-arranged but you do not see the changes.

Under MSIE per se, all XML documents are transformed immediately with the defaultss.xsl.

res://msxml.dll/defaultss.xsl
or
res://msxml3.dll/defaultss.xsl

Under the Browser Control's Document.body.innerHTML, you see the state of the DOM as it actually is and as such, you will see the transformed output. If you were to view it via the View Source Menu, you will see the XML document as it actually is.

If you want to view the XML, you should not be using the WebBrowser Control but the XMLHTTP object or DOMDocument30 | DOMDocument40 Object.

Sample Code
===========
Dim oHTTP AS Msxml2.XMLHTTP30
Set oHTTP = New Msxml2.XMLHTTP30
oHTTP.open "GET","http://myserver.com/data.xml", False
oHTTP.send
Debug.Print oHTTP.responseXML.xml
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7722560
Hi rjef,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept b1xml2's comment(s) as an answer.

rjef, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7780780
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 connector to SQL Server 2 37
Hide vba in gp 7 95
How to hault or freeze parent form when a 2d form is open in vb6 3 38
Set email body to html using vbscript 6 42
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

832 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