Maybe it would serve xml if you sent the request with a header specifying {'Accept' => 'application/xhtml+xml'} ? But I don't think you can specify a header with Net::HTTP.get_response(), maybe try using Net::HTTP#get() ?
Dan
Peter Kemp wrote:
···
Hi all,
Im trying to retrieve an xml document from a website but all i get is
the html
I know their is a way to get this same page via xml
Anyway it's not a Ruby issue, you need to find the right URL first.
I'm not sure if you can use the Accept header, that depends on the
site you are accessing.
···
On 4/24/07, Peter Kemp <peterkemp@gmail.com> wrote:
John Joyce wrote:
> Perhaps they're serving xhtml?
> then it is xml.
XML is a markup language with some general but strict rules. Its actual structure varies widely. iTunes playlists, MS Word document metadata, and yes xhtml. not old html, but a form of it that is replacing it and is compliant with xml rules. (more or less)
Most xml files are probably hashes with nested hashes (associative arrays with nested associative arrays), and they follow the KVC format, Key=>Value coding. Great for storing data and preferences and all kinds of things. And easy to change from one format to another.
XML is a pretty simple, but often confusing topic. Most books treat it as a subject distinct from anything else, but it isn't.
There are some Java and XML books, for example that introduce XML in a working environment.
Just remember it's structured data, stored as a text file. Conceptually, not different from YAML, just more strict.
···
On Apr 24, 2007, at 2:23 PM, Phillip Gawlowski wrote: