Questions tagged [simplexml]

A PHP extension shipped with the main source tree. The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators. For the Java "Simple" XML framework, please use the [simple-framework] tag.

The SimpleXML extension provides a simple toolset to convert XML to an object that can be processed with normal property selectors and array iterators.

Once an XML document is converted, the object obtained will reference the root element of the document. The object's properties will reflect the child nodes and uses the same name as the nodes. This principle works recursively across the document.

3932 questions
20
votes
6 answers

Looping through a SimpleXML object, or turning the whole thing into an array

I'm trying to work out how to iterate though a returned SimpleXML object. I'm using a toolkit called Tarzan AWS, which connects to Amazon Web Services (SimpleDB, S3, EC2, etc). I'm specifically using SimpleDB. I can put data into the Amazon SimpleDB…
Coffee Cup
  • 253
  • 1
  • 2
  • 7
20
votes
1 answer

XPath with multiple contains on different elements

Is it possible to have XPath expression with multiple contains of different element values? XML Kerry Packer
Crown
TeaCupApp
  • 11,316
  • 18
  • 70
  • 150
19
votes
1 answer

'Serialization of 'SimpleXMLElement' is not allowed when saving in Wordpress post_meta

I am working on an amazon affiliate wordpress page. For that I am using the aws_signed_request function to get the price and link from amazon. Here is the aws_signed_request function returning the xml: function aws_signed_request($region,…
user2078789
  • 191
  • 1
  • 1
  • 3
19
votes
4 answers

How to get the value of an attribute from XML file in PHP?

Sorry if this seems like an easy question, but I've started pulling hair out on this... I have a XML file which looks like this... I'm trying to get the VarNum. So far I've been successful using the…
Matt
  • 7,022
  • 16
  • 53
  • 66
19
votes
7 answers

PHP SimpleXML + Get Attribute

The XML I am reading looks like this: The Big Bang Theory http://www.tvrage.com/The_Big_Bang_Theory 2007-09-24 USA
r0skar
  • 8,338
  • 14
  • 50
  • 69
18
votes
4 answers

Simple XML - Dealing With Colons In Nodes

I'm trying to read an RSS feed from Flickr but it has some nodes which are not readable by Simple XML (media:thumbnail, flickr:profile, and so on). How do I get round this? My head hurts when I look at the documentation for the DOM. So I'd like to…
Ben Shelock
  • 20,154
  • 26
  • 92
  • 125
17
votes
3 answers

adding a namespace when using SimpleXMLElement

This is what I am after somevalue2 foo bar This is my current code