homepage Welcome to WebmasterWorld Guest from 54.161.200.144
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Load XML elements on HTML page
from a different server
visa666




msg:3989437
 12:09 am on Sep 15, 2009 (gmt 0)

Hi Everybody

I am trying to load selected elements of a xml dtd formatted page onto a html page.
The xml and html pages are on different servers.
Here is part of the xml page:
Quote:
-<shrs>
-<rq url="http://api.example.com/a/j-api/xml-v2/7">
<t>Doctor </t>
<dt>2009-09-14T22:24:19Z</dt>
<si>0</si>
<rpd>10</rpd>
<tr>200691</tr>
<tv>1000</tv>
<em url=""/>
-<h>
<kw pos="1"/>
</h>
</rq>
-<rs>
-<r>
<jt>Title</jt>
<cn url="">URL</cn>
<src url="http://api.example.com/a/j-api/xml-v2/7Dk0JmNfaWQ9NDgzNSZwX2lkPTEzNTcwJnBvcz0xJnpvbmU9NiZjcGM9MC4xNiZpcD0maGFzaD03NWNhMjlhMjQ0MTQzMzYwNzVk YTFiODI1ZjAwZDE5YiZjb3VudD0yJnN</src>
<ty>sponsored</ty>
<loc cty="" st="MS" postal="" county="" region="" country="US">STATES</loc>
<ls>2009-08-31T12:54:43Z</ls>
<dp>2009-08-31T12:54:43Z</dp>
-<e>
----------------------
</e>
</r>
.
.
.
.
.
.

Any ideas?

Thanks

[edited by: httpwebwitch at 1:01 pm (utc) on Sep. 17, 2009]
[edit reason] examplified [/edit]

 

httpwebwitch




msg:3990913
 1:09 pm on Sep 17, 2009 (gmt 0)

I always use a server-side language to do this kind of thing. In PHP there is a simple XML parser [ca3.php.net] that you would find useful; similar facilities exist in C#.NET, Java, Perl, Python, Ruby, VBScript, etc.

First, you request the XML from the 3rd party server. Then you parse it and turn it into an XML object. Then use XPATH to grab the nodes you want, or perhaps iterate through nodes looking for pattern matches. Once found, the result can be output to your HTML page.

You can find practical examples here [ca3.php.net]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved