• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 798
  • Last Modified:

get xml information using webbrowser control

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
rjef
Asked:
rjef
  • 5
  • 4
  • 3
  • +3
1 Solution
 
Richie_SimonettiIT OperationsCommented:
How do you get source code?

try:
' in document_complete event of webbrowser

debug.print webbrowser.document.documentelement.innerhtml
0
 
rjefAuthor Commented:
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
 
robbertCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Richie_SimonettiIT OperationsCommented:
"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
 
robbertCommented:
XML in IE is converted to that syntax-highlighted HTML when displayed.

So it is:
webbrowser.document.documentelement.innerTEXT
0
 
Richie_SimonettiIT OperationsCommented:
Well, what we need here, html code or pure text contents?
0
 
robbertCommented:
pure text = xml
0
 
rjefAuthor Commented:
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
 
robbertCommented:
> <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
 
rjefAuthor Commented:
It is an internal website
0
 
robbertCommented:
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
 
rjefAuthor Commented:
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
 
b1xml2Commented:
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
 
DanRollinsCommented:
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
 
SpideyModCommented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Independent Software Vendors: 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!

  • 5
  • 4
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now