Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 5th, 2007, 06:15 PM
dakrin
Guest
 
Posts: n/a
Default Reading XML Webpage Without XSLT

i'm trying to programatically read the xml that is used to create a
webpage through xslt transformations.

I can view the XML when i go to "View Source" in internet explorer,
but whenever i try to download the webpage programmatically i can't
ever get the source XML, i always get the transformed html.

Any ideas? I've tried everything i can think of :(

  #2  
Old March 5th, 2007, 11:15 PM
Peter Flynn
Guest
 
Posts: n/a
Default Re: Reading XML Webpage Without XSLT

dakrin wrote:
Quote:
i'm trying to programatically read the xml that is used to create a
webpage through xslt transformations.
>
I can view the XML when i go to "View Source" in internet explorer,
but whenever i try to download the webpage programmatically i can't
ever get the source XML, i always get the transformed html.
>
Any ideas? I've tried everything i can think of :(
wget or dog does it for me.

///Peter
  #3  
Old March 6th, 2007, 11:45 AM
dakrin
Guest
 
Posts: n/a
Default Re: Reading XML Webpage Without XSLT

On Mar 5, 5:01 pm, Peter Flynn <peter.n...@m.silmaril.iewrote:
Quote:
>
wget or dog does it for me.
>
///Peter

Well, I'm trying to finding a way to programatically do it using c#.
I've tried using xmlDocument.load(), getresponsestream(),
xmlreader.create(), etc. but they all get the html-output, not the
original xml file.

I downloaded wget for windows just to try it out and it downloaded the
html as well.

The only way I can view the xml is when i go to "View Source" in IE.

Any ideas?

  #4  
Old March 6th, 2007, 12:55 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: Reading XML Webpage Without XSLT

dakrin wrote:
Quote:
Well, I'm trying to finding a way to programatically do it using c#.
I've tried using xmlDocument.load(), getresponsestream(),
xmlreader.create(), etc. but they all get the html-output, not the
original xml file.
>
I downloaded wget for windows just to try it out and it downloaded the
html as well.
>
The only way I can view the xml is when i go to "View Source" in IE.
Please post an example URL you are trying to access, if the server sends
HTML after doing an XSLT transformation on the server then it is usually
not possible to access the XML, unless the server exposes that as well.
And if you really get HTML back then XML tools like the Load method of
XmlDocument or XmlReader will simply abort parsing and tell you the
markup is not well-formed XML.



--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
  #5  
Old March 6th, 2007, 01:05 PM
dakrin
Guest
 
Posts: n/a
Default Re: Reading XML Webpage Without XSLT

Please post an example URL you are trying to access, if the server sends
Quote:
HTML after doing an XSLT transformation on the server then it is usually
not possible to access the XML, unless the server exposes that as well.
And if you really get HTML back then XML tools like the Load method of
XmlDocument or XmlReader will simply abort parsing and tell you the
markup is not well-formed XML.
>
--
>
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
When I do "View Source" in Internet Explorer the XML shows up, so I'm
assuming that means its applying the xsl client side.

Here's an example site that does what i'm talking about:

http://armory.worldofwarcraft.com/ar...1&sf=rank&sd=a

  #6  
Old March 6th, 2007, 04:35 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: Reading XML Webpage Without XSLT

dakrin wrote:
Quote:
When I do "View Source" in Internet Explorer the XML shows up, so I'm
assuming that means its applying the xsl client side.
>
Here's an example site that does what i'm talking about:
>
http://armory.worldofwarcraft.com/ar...1&sf=rank&sd=a
The might sniff the user agent server side and depending on that serve
XML or HTML, try it like this

HttpWebRequest httpRequest =
(HttpWebRequest)WebRequest.Create(@"http://armory.worldofwarcraft.com/arena-ladder.xml?b=Stormstrike&ts=3&p=1&sf=rank&sd=a");
httpRequest.UserAgent =
@"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
HttpWebResponse httpResponse =
(HttpWebResponse)httpRequest.GetResponse();
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(httpResponse.GetResponseStream()) ;
httpResponse.Close();
xmlDocument.Save(Console.Out);

that way I get XML starting with

<?xml-stylesheet type="text/xsl" href="/layout/arena-ladder.xsl"?>
<page globalSearch="1" lang="en_us" requestUrl="/arena-ladder.xml">

It might also be necessary or helpful to set the Accept HTTP request
header but that depends on what they are doing on the server, it is not
really an XML problem but rather a HTTP problem.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
  #7  
Old March 6th, 2007, 09:55 PM
Peter Flynn
Guest
 
Posts: n/a
Default Re: Reading XML Webpage Without XSLT

dakrin wrote:
Quote:
On Mar 5, 5:01 pm, Peter Flynn <peter.n...@m.silmaril.iewrote:
Quote:
>wget or dog does it for me.
>>
>///Peter
>
>
Well, I'm trying to finding a way to programatically do it using c#.
I've tried using xmlDocument.load(), getresponsestream(),
xmlreader.create(), etc. but they all get the html-output, not the
original xml file.
>
I downloaded wget for windows just to try it out and it downloaded the
html as well.
In that case the transformation must be being done server-side.
AFAIK wget does not contain an XSLT processor.
Quote:
The only way I can view the xml is when i go to "View Source" in IE.
What's the URI?

///Peter
  #8  
Old March 7th, 2007, 07:15 PM
dakrin
Guest
 
Posts: n/a
Default Re: Reading XML Webpage Without XSLT

Martin Honnen wrote:
Quote:
The might sniff the user agent server side and depending on that server
XML or HTML, try it like this
Yep, that worked. Thanks very much :)

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles