Forum Moderators: open

Message Too Old, No Replies

How to integrate XML data feed.

...into my HTML site.

         

macz_g

4:34 pm on Dec 7, 2005 (gmt 0)

10+ Year Member



Hello.

I have an XML feed of products from a merchant and I want to integrate that into my site.

Can anyone point me in the right direction of a tutorial or resource?

Thanks in advance.

mrMister

1:53 pm on Dec 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will most likely be wanting to use XSLT (EXtensible Stylesheet Language Transformations). XSLT transforms one type of XML document in to another (althought it will also transform XML documents in to HTML (SGML based) as well as XHTML (XML based).

[w3.org...]
[w3schools.com...]
[xml.com...]

macz_g

8:08 pm on Dec 8, 2005 (gmt 0)

10+ Year Member



Excellent.

Time to get reading.

mrMister

2:54 pm on Jan 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Incendentally, I highly recommend O'Reilly's XML in a Nutshell book (ISBN: 0596007647) which is a great resource for XML based stuff including an excellent section on XSL.

stef25

3:12 pm on Jan 4, 2006 (gmt 0)

10+ Year Member



Could “integrating into my site” not also just be parsing the xml with php or javascript? I guess much more can be done with XSLT but im not quite sure when to use either technique

mrMister

8:49 am on Jan 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ould “integrating into my site” not also just be parsing the xml with php or javascript?

Yes, you could parse it in PHP or Javascript. However, it requires much more code, it'll be harder to update, it'll reduce the readability or your code, it'll be language dependant (if you switch from PHP/Javascript you'll need to recode it) and more than likely it'll be less efficient.

im not quite sure when to use either technique

As a rule of thumb, if you are transforming a document (ie converting from XML to another type of XML/HTML document), use XSLT. It you are trying to retreive data for use elsewhere in your application (eg. placing the data in a databse), parse it with the XML DOM.