Jump to content


Help getting Results with .xml?


6 replies to this topic

#1 Mr. Jay

    Young Padawan

  • Members
  • Pip
  • 81 posts

Posted 25 November 2006 - 11:27 PM

Can you tell me what I did wrong? :S

item.php
<html>
<body>

<xml id="result" src="item.xml"></xml>

<table border="1" datasrc="#result">

<tr>
<td><span datafld="item:name"></span></td>
<td><span datafld="item:description"></span></td>
</tr>

</table>

</body>
</html>

item.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<itemdb>
<item members="true" name="Dwarf remains" type="0" description="The body of a Dwarf savaged by Goblins.">
</item>
</itemdb>

Trying to get it to result as
---------------------------------------------------------------------------
|Dwarf remains | The body of a Dwarf savaged by Goblins. |
---------------------------------------------------------------------------

#2 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 26 November 2006 - 02:41 AM

A good parser that is already written is SimplePie

I've used it and it works quite well and if you have your rss feed where you can access it publically on their web site as they have a demo available where you can put in your rss fee link

#3 Mr. Jay

    Young Padawan

  • Members
  • Pip
  • 81 posts

Posted 26 November 2006 - 04:01 AM

View PostSpatialVisionary, on Nov 26 2006, 01:41 AM, said:

A good parser that is already written is SimplePie

I've used it and it works quite well and if you have your rss feed where you can access it publically on their web site as they have a demo available where you can put in your rss fee link

im not doing an rss feed :S

Im trying to get it to result as

---------------------------------------------------------------------------
|_____Item_____| ___________Description___________ |
---------------------------------------------------------------------------
|Dwarf remains | The body of a Dwarf savaged by Goblins. |
---------------------------------------------------------------------------
so on
& so on

Edited by Jonpopnycorn, 26 November 2006 - 04:02 AM.


#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 26 November 2006 - 03:21 PM

PHP isn't XML. You saved the first item.php as a php file and didn't tell the browser it was an XML file, so it's not going to parse the xml.

Other then that, i don't know xml well enough to tell you if anything is wrong with that part.

#5 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 26 November 2006 - 07:24 PM

View PostJonpopnycorn, on Nov 26 2006, 03:01 AM, said:

View PostSpatialVisionary, on Nov 26 2006, 01:41 AM, said:

A good parser that is already written is SimplePie

I've used it and it works quite well and if you have your rss feed where you can access it publically on their web site as they have a demo available where you can put in your rss fee link

im not doing an rss feed :S

Im trying to get it to result as

---------------------------------------------------------------------------
|_____Item_____| ___________Description___________ |
---------------------------------------------------------------------------
|Dwarf remains | The body of a Dwarf savaged by Goblins. |
---------------------------------------------------------------------------
so on
& so on

RSS is written using XML. Using PHP you have to parse the information which is why I recommended http://simplepie.org

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version="2.0">
  <channel>
	<title>Your Site Name</title>
	<link>http://www.yoursite.com</link>
	<description>Site Description</description>
	<generator>Feeder 1.2.2.1 http://reinventedsoftware.com/feeder/</generator>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<language>en</language>
	<copyright>Your Name</copyright>
	<pubDate>Fri, 05 May 2006 23:01:03 -0500</pubDate>
	<lastBuildDate>Fri, 05 May 2006 23:01:04 -0500</lastBuildDate>
	<item>
	  <title>Title for Item 1</title>
	  <link>Link for Item 1</link>
	  <description>Description for Item 1</description>
	  <pubDate>Fri, 05 May 2006 23:01:03 -0500</pubDate>
	</item>
  </channel>
</rss>

http://simplepie.org is a good place to start, as it will parse the typical information that is in an RSS/XML feed. I haven't learned enough about XML parsing to know how to parse the other stuff you have.

I know it would be in the XML feed something like this:
	<item>
	  <title>Title for Item 1</title>
	  <link>Link for Item 1</link
	  <member>true</member>
	  <type>0</type>
	  <description>Description for Item 1</description>
	  <pubDate>Fri, 05 May 2006 23:01:03 -0500</pubDate>
	</item>
or something like that

#6 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 27 November 2006 - 04:21 PM

<html>
<body>

<xml id="result" src="item.xml"></xml>

<table border="1" datasrc="#result">

<tr>
<td><span datafld="item:name"></span></td>
<td><span datafld="item:description"></span></td>
</tr>

</table>

</body>
</html>
Spatial... RSS isn't being used. PHP isn't being used. While a php xml parser would probably be nice to have, changing the file extension to .xml and adding the xml header info to make it an XHTML file would probably be easier. But like i said, i don't know enough xml to say if that will work... I can say it would be the easiest fix, and if it doesn't work, then we can explore a php solution.

Edited by rc69, 27 November 2006 - 04:22 PM.


#7 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 27 November 2006 - 10:48 PM

View Postrc69, on Nov 27 2006, 03:21 PM, said:

Spatial... RSS isn't being used. PHP isn't being used. While a php xml parser would probably be nice to have, changing the file extension to .xml and adding the xml header info to make it an XHTML file would probably be easier. But like i said, i don't know enough xml to say if that will work... I can say it would be the easiest fix, and if it doesn't work, then we can explore a php solution.

I wish some enlighten me on what he is doing then, because I'm confused. :(





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users