Jump to content

labiere33

Members
  • Posts

    3
  • Joined

  • Last visited

labiere33's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry I only seem to be able to mark one of those last two replies as "best". Just to help anyone else out looking for similar information I thought I would add, The example I quoted above seems to be a little dated. I actually ran across it from Lynda.com in their "XML Basics" video tutorial. Understandably, no one really explained how to modify that example. SimpleXML that became available in PHP 5 seems to be an easier way to achieve the goal. I have latched on to the Basic Tutorial at php net and I should be able to help myself further along now. Thanks.
  2. I have a web page calling a PHP script that is trying to read an xml file from an external source and do something with the values, like display them in an HTML table or maybe insert them into a mySQL database. But I want to display both the tag attribute values and values between tags. So something like: <?xml version="1.0" ?> <item status="active"> <desc language="en">WIDGET</desc> </item> could be parsed into an HTML table like this: <table> <tr> <td>active</td> <td>en</td> <td>WIDGET<td> </tr> </table> So yes, I want to parse the entire xml file, creating a new table row in my output table for each "Item" tag I encounter.
  3. I've been trying to figure out how to parse an xml file using PHP and to output some HTML. I followed an example from joemarini.com Display a List of Categorized Links with PHP, XML, and SAX The example xml being parsed is only showing tags with attributes, but not with text values within the tag pairs. So I see how to apply the php example to xml that looks like this: <tagname> <tag1 attr="foo"> <tag2 attr1="one" attr2="two"></tag2> </tag1> </tagname> but not to xml that looks like this: <tagname> <tag1 attr="foo"> <tag2 attr1="one" attr2="two">SOME TEXT VALUE ADDED HERE</tag2> </tag1> </tagname> Basically I want to modify the php example so that it allows me to not only store and do something with the attribute values as it parses, but also the text values between the tag pairs. (Is this what is being called the CDATA everywhere I look?) I have found examples that parse the values between tags and they look very different from the code example I have here that parses attribute values. Any help is appreciated. links.php links.xml
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.