Question

FOXPRO: get data from browser returned XML into a table

Asked by: genehead

How do I get data from a browser page of XML into a table?  I opened the page with an instance of the Internet Explorer object.  This is code I inherited so I don;t know much about it - yet . . .   ugh

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-11-20 at 17:20:26ID23923737
Tags

Microsoft

,

Visual Foxpro

,

7.0

,

Foxpro

Topic

FoxPro Database

Participating Experts
4
Points
125
Comments
12

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Advantanges & Disadvantages in Foxpro
    1. I would like to know the advantanges and disadvanteges in Visual foxpro compare to other DBMS
  2. XML
    Hi Experts, I have XML file and XSLT(formats CSV file) that are ready for use. How to make in JSP to write this file to temp directory and open using Internet Explorer ? Thank you.

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: tusharkanvindePosted on 2008-11-20 at 20:48:16ID: 23010603

Try
YourIEObject.Document.firstchild.innerHtml
or
YourIEObject.Document.firstchild.innerText

 

by: JF0Posted on 2008-11-21 at 08:59:50ID: 23014785

Explore the STREXTRACT() function, this might get you what you need.

 

by: tusharkanvindePosted on 2008-11-21 at 10:17:45ID: 23015530

If you want to convert an XML to a cursor, use the function XMLTOCURSOR

 

by: geneheadPosted on 2008-11-21 at 11:09:27ID: 23015970

I appreciate the replies but what I need is a sample code snipit.  How do I access the browser text?  Imagine a browser display of a pure XML because that is what I have.  I create a browser object, give it a url with parameters and get back XML; but how do I access the XML from the browser object?  This is probably VERY VERY trivial but I'm just not getting it.

Code might look like this:

Create browser object
browserobject.url_string_with parameters
browserobject.execute

var = xml_to_data(browserobject.result_page_text)

I don't know . . . .

 

by: tusharkanvindePosted on 2008-11-21 at 11:50:33ID: 23016327

What does
browserobject.Document.firstchild.innerHtml
or
browserobject.Document.firstchild.innerText
give you ?

 

by: ramromPosted on 2008-11-21 at 18:26:44ID: 23018780

Dealing with XML depends on how it is arranged.

Show us a sample of the web page source.

 

by: geneheadPosted on 2008-11-21 at 19:01:50ID: 23018924

Here is what I see.  I want the contact information' address and phone.  There may be more than one value returned as in any ambiguous auery,

  <?xml version="1.0" encoding="UTF-8" ?>
- <wp:wp xmlns:wp="http://api.whitepages.com/schema/">
  <wp:result wp:type="success" wp:message="" wp:code="Found Data" />
- <wp:meta>
  <wp:linkexpiration>2008-11-26</wp:linkexpiration>
  <wp:recordrange wp:lastrecord="2" wp:firstrecord="1" wp:totalavailable="2" />
  <wp:apiversion>1.0</wp:apiversion>
- <wp:searchlinks>
  <wp:link wp:linktext="Whitepages.com" wp:type="homepage">http://www.whitepages.com/16176/</wp:link>
  <
wp:link wp:linktext="Link to this api call" wp:type="self">http://api.whitepages.com/find_person/1.0/?firstname=Gene;lastname=Head;name=Gene+Head;street=22344+SW+Main+St;city=Sherwood;state=OR;api_key=a087e4d4407878265d7c57a739bf5049</wp:link>
  <
wp:link wp:linktext="View All Results" wp:type="allresults">http://www.whitepages.com/16176/track/10211/log_feature/listing_category/search/Replay/?search_id=64211301729610712863</wp:link>
  <
wp:link wp:linktext="View Work Listings" wp:type="worklistings">http://www.whitepages.com/16176/track/10209/log_feature/listing_category/search/Replay/?search_id=64211301729610712863&view=&listing_category=B</wp:link>
  <
/wp:searchlinks>
  </wp:meta>
- <wp:listings>
- <wp:listing>
- <wp:people>
- <wp:person wp:rank="primary">
  <wp:firstname>Gene</wp:firstname>
  <wp:middlename>R</wp:middlename>
  <wp:lastname>Head</wp:lastname>
  </wp:person>
- <wp:person wp:rank="secondary">
  <wp:firstname>Jacqueline</wp:firstname>
  <wp:middlename>J</wp:middlename>
  <wp:lastname>Head</wp:lastname>
  </wp:person>
  </wp:people>
- <wp:phonenumbers>
- <wp:phone wp:type="home" wp:rank="primary">
  <wp:fullphone>(503) 625-1768</wp:fullphone>
  <wp:areacode>503</wp:areacode>
  <wp:exchange>625</wp:exchange>
  <wp:linenumber>1768</wp:linenumber>
  </wp:phone>
  </wp:phonenumbers>
- <wp:address wp:deliverable="true">
  <wp:fullstreet>22344 SW Main St</wp:fullstreet>
  <wp:house>22344</wp:house>
  <wp:predir>SW</wp:predir>
  <wp:street>SW Main St</wp:street>
  <wp:streettype>St</wp:streettype>
  <wp:city>Sherwood</wp:city>
  <wp:state>OR</wp:state>
  <wp:zip>97140</wp:zip>
  <wp:zip4>9416</wp:zip4>
  <wp:country>US</wp:country>
  </wp:address>
- <wp:geodata>
  <wp:geoprecision>5</wp:geoprecision>
  <wp:latitude>45.354570</wp:latitude>
  <wp:longitude>-122.864160</wp:longitude>
  </wp:geodata>
- <wp:listingmeta>
  <wp:lastvalidated>03/2008</wp:lastvalidated>
  <wp:type>home</wp:type>
- <wp:moreinfolinks>
  <wp:link wp:linktext="Find Neighbors" wp:type="findneighbors">http://www.whitepages.com/16176/track/10214/search/FindNeighbors?addr_research=1&tmpl=search_research_neighbors&search_id=64211301729610712863&rarl=&element_id=0</wp:link>
  <
wp:link wp:linktext="View Map" wp:type="viewmap">http://www.whitepages.com/16176/track/10213/map_provider?full_address=22344+SW+Main+St&city=Sherwood&state=OR&zip=97140&country=US&lat=45.354570&long=-122.864160&name=Head&firstname=Gene+R&show_form=false</wp:link>
  <
wp:link wp:linktext="Driving Directions" wp:type="drivingdirections">http://www.whitepages.com/16176/track/10216/map_provider?=&show_form=true&full_address=22344+SW+Main+St&city=Sherwood&state=OR&zip=97140&country=US&lat=45.354570&long=-122.864160&name=Head&firstname=Gene+R</wp:link>
  <
wp:link wp:linktext="View Listing Detail" wp:type="viewdetails">http://www.whitepages.com/16176/track/10215/search/Replay?search_id=64211301729610712863&lower=1&more_info=1</wp:link>
  <
/wp:moreinfolinks>
  </wp:listingmeta>
  </wp:listing>
- <wp:listing>
- <wp:people>
- <wp:person wp:rank="primary">
  <wp:firstname>Gene</wp:firstname>
  <wp:lastname>Head</wp:lastname>
  </wp:person>
  </wp:people>
- <wp:business wp:rank="primary">
  <wp:businessname>Liftedup</wp:businessname>
  </wp:business>
- <wp:phonenumbers>
- <wp:phone wp:type="work" wp:rank="primary">
  <wp:fullphone>(503) 799-5381</wp:fullphone>
  <wp:areacode>503</wp:areacode>
  <wp:exchange>799</wp:exchange>
  <wp:linenumber>5381</wp:linenumber>
  </wp:phone>
  </wp:phonenumbers>
- <wp:address wp:deliverable="true">
  <wp:fullstreet>22344 SW Main St</wp:fullstreet>
  <wp:house>22344</wp:house>
  <wp:predir>SW</wp:predir>
  <wp:street>SW Main St</wp:street>
  <wp:streettype>St</wp:streettype>
  <wp:city>Sherwood</wp:city>
  <wp:state>OR</wp:state>
  <wp:zip>97140</wp:zip>
  <wp:zip4>9416</wp:zip4>
  <wp:country>US</wp:country>
  </wp:address>
- <wp:geodata>
  <wp:geoprecision>5</wp:geoprecision>
  <wp:latitude>45.354570</wp:latitude>
  <wp:longitude>-122.864160</wp:longitude>
  </wp:geodata>
- <wp:listingmeta>
  <wp:lastvalidated>02/2008</wp:lastvalidated>
  <wp:type>work</wp:type>
- <wp:moreinfolinks>
  <wp:link wp:linktext="Find Neighbors" wp:type="findneighbors">http://www.whitepages.com/16176/track/10214/search/FindNeighbors?addr_research=1&tmpl=search_research_neighbors&search_id=64211301729610712863&rarl=&element_id=1</wp:link>
  <
wp:link wp:linktext="View Map" wp:type="viewmap">http://www.whitepages.com/16176/track/10213/map_provider?full_address=22344+SW+Main+St&city=Sherwood&state=OR&zip=97140&country=US&lat=45.354570&long=-122.864160&name=Head&firstname=Gene&show_form=false</wp:link>
  <
wp:link wp:linktext="Driving Directions" wp:type="drivingdirections">http://www.whitepages.com/16176/track/10216/map_provider?=&show_form=true&full_address=22344+SW+Main+St&city=Sherwood&state=OR&zip=97140&country=US&lat=45.354570&long=-122.864160&name=Head&firstname=Gene</wp:link>
  <
wp:link wp:linktext="View Listing Detail" wp:type="viewdetails">http://www.whitepages.com/16176/track/10215/search/Replay?search_id=64211301729610712863&lower=2&more_info=1</wp:link>
  <
/wp:moreinfolinks>
  </wp:listingmeta>
  </wp:listing>
  </wp:listings>
  </wp:wp>

 

by: Olaf_DoschkePosted on 2008-11-23 at 14:54:40ID: 23026187

you would not use a browser object for that, but an XMLRequest. Also take a look at the vfp help topics on wb services, soap and the soap toolkit.

I found that whitepages.com offers an XSD schema you can use to parse their XML results: http://developer.whitepages.com/docs/XSD

Save this xsd as an xsd file. Take a look at the XMLAdapter class, you can set it's XMLSchemalocation to the xsd file and it will use the xsd schema for validating the xml, when you use the LoadXML method and pass on the xml you get by the xmlrequest.

Bye, Olaf.

Local lcXML, loXMLRequest
loXMLRequest = CreateObject("msxml2.xmlhttp")
loXMLRequest.open("GET",cSomeWhitepagesURL,.F.)
loXMLRequest.send(.null.)
lcXML = o.responseXML
                                              
1:
2:
3:
4:
5:

Select allOpen in new window

 

by: Olaf_DoschkePosted on 2008-11-23 at 14:56:01ID: 23026188

edit the last line of my code snippet to

lcXML = loXMLRequest.responseXML

                                              
1:

Select allOpen in new window

 

by: geneheadPosted on 2008-11-24 at 15:35:27ID: 23031476

Olaf's reply looks like what I need - THANKS.  Let me test it and I'll award the points.

Thanks to all who commented.

gene

 

by: geneheadPosted on 2008-11-27 at 20:54:22ID: 23053822

Thanks

 

by: Olaf_DoschkePosted on 2008-11-28 at 00:36:40ID: 23054319

By your closing request comment I assume the direct problem to get the XML is solved, but now you want more sample code how to work on the retrieved XML.

It's rather specific to each webservice, but there is of coure some general stuff:

typically a webservice is described by a wsdl file, from that you can retreive in a generic way, what methods are offered and what type if parameters are expected and what type of results you get. Aside from this starting point there are several specifications so there is no one size fits all solution to process the xml a webservice returns.

All in all the XML is just the envelope around the real data and webservice methods are like any class methods, they return very individual results, which makes it impossible to have a generic way of handling it. Like there is no generic way to work with any method of any class.

There are some generics on getting the real data unwrapped from the XML. The buzzword is parsing XML. VFP's XMLAdapter is a class giving you rather high level methods, eg after LoadXML() you may find a Tables collection filled (if VFP detcts tabular data embedded in the XML) and can do XMLAdapter.Tables(N).ToCursor() to get tabular data into a foxpro cursor, there are also very low level parsing methods like traversing the XML nodes, you find the root of the DOM representation of the XML in XMLAdapter.IXMLDOMElement. So this and the XMLAdapter.Tables collection are your starting points in parsing XML in Foxpro.

Bye, Olaf.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...