Forum Moderators: open

Message Too Old, No Replies

Getting My XML Feet Wet in PHP

Boy, What A Boulliabaise of Information! All I Need is a Simple Example.

         

cmarshall

10:20 pm on Mar 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm just getting started with XML, as it applies to Web pages. I've used it as a method of storing and transferring information in software, but have not used XSLT.

Here's the scenario: I have a site that outputs a set of <table> elements that are completely XHTML 1.1 compliant. Since they are displaying tabular data, that's as it should be.

Now, I want to display it on cellphones. Most modern phones will easily display it with XHTML and a handheld media CSS file, but I'd like to tap WURFL [wurfl.sourceforge.net], which will open up a gazillion more phones for me. In order to use WURFL, I need to start with XML.

Every single example out there assumes that you are beginning with a "pure" XML document. Even though XHTML 1.1 is XML, it doesn't seem to fit the models posited in any of the examples.

For example, I know that I need to translate the <table><tr> and <td> tags into <div> tags. No problem. I can do this with preg_replace, but that still leaves me with the same problem. I also think that there is a more elegant way to do it with XSLT.

Probably the most likely example is one where a PHP program is used to read a Web page and turn it into an RSS stream. I could figure it out from there.

I really just need a good starting point. I'd rather not go through six months of academic "hello world" examples if there are some directly practical ones available.

I eagerly await helpful hints. I don't intend to remain a newbie long (I don't usually).

[edited by: encyclo at 1:20 am (utc) on Mar. 17, 2007]