Forum Moderators: open

Message Too Old, No Replies

XML feed - How to show only part of a file

Can PHP selectively ignore items I don't like?

         

ClickHere

3:13 am on Jan 10, 2005 (gmt 0)

10+ Year Member



I have a website which pulls in an XML file from an outside source. The problem is I don't want to show the whole file, only some of it. Something like where STATE = 'NY'. I am parsing the file with PHP but I only know enough to be dangerous with it.

Storyman

5:22 pm on Jan 19, 2005 (gmt 0)

10+ Year Member



ClickHere,

I'm new to XML too. Just found this XML tutorial, which might helpful.

[w3schools.com...]

Also, if you are familar with SitePoint they are publishing a book about XML/PHP shortly.

ClickHere

1:11 am on Jan 22, 2005 (gmt 0)

10+ Year Member



I'll answer my own question, for the benefit of any other newbies who pass by. The way to control which parts of an XML file you want to use is with XSL. It is similar to using a CSS style sheet, but for XML files. I had to have my PHP installation upgraded to use the 'xslt' module. My understanding is that in PHP 5 this is already built-in.

So now I have been able to display an external XML file as-is. I also have a valid(*) XSL document. But when I put the two together in PHP it complains about an 'invalid token'. But surely I am getting closer.

* A clever way to check your XSL doc for syntax errors is to rename it .xml and view it in Internet Explorer.

Storyman

2:44 am on Jan 22, 2005 (gmt 0)

10+ Year Member



Maybe this will help.

[nyu.edu...]