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
1
vote
2 answers

Export Array of SimpleXMLElement objects to MySQL Database

I have a SOAP Response from a Web Service and have extracted the XML data as a SimpleXMLElement. I have then iterated through this object to extract the various fields I need and save them into an array, which becomes an array of SimpleXMLElement…
John Dawson
  • 443
  • 3
  • 10
  • 28
1
vote
1 answer

How to write values from SimpleXML array in input field

I have a simpleXML array called $tags that contains a list of tags which I would like to use for the default value of an input field when loading a page. My XML (example): Array ( [0] => SimpleXMLElement Object ( [0] => tag1 ) [1] =>…
user2571510
  • 11,167
  • 39
  • 92
  • 138
1
vote
1 answer

php SimpleXMLElement weird behaviour

I'm using a tool which exports data from a database to an XML file. I'm writing an object which can take the XML file, perform various filters, validations etc etc to it, and import it into a second database. I have an array which contains the XML…
Phil Cross
  • 9,017
  • 12
  • 50
  • 84
1
vote
2 answers

How do I get access to keys/attributes of a simple-xml object

I have a xml-object looks like this: Or with var_dump(): object(SimpleXMLElement)[1012] public 'search' => object(SimpleXMLElement)[1078] …
Zwen2012
  • 3,360
  • 9
  • 40
  • 67
1
vote
2 answers

How to group comma separated values

I want group the comma separated values in the columns. For example, in the following data, I want to group the first value of each row in a group A, second in group B and so on. The values are random and the purpose is to generate an XML…
user1355300
  • 4,867
  • 18
  • 47
  • 71
1
vote
1 answer

asXML() not saving changes

I have a complex xml with nested namespaces for which I'm trying to do the following: 1) Open XML File 2) Validate against a XSD Schema 3) Parse it 4) Change nodes (1 at the time, setting them either to null or other variables) 5) Saves changed xml…
user3375601
  • 119
  • 2
  • 9
1
vote
0 answers

Load simple XML from string

My problem: my received string size is ca. 4 MB and this string doesn't not load in simplexml_load_string (return bool(false)). The data is received with SoapClient. How can I load this string in xml? Code: $client = new…
LSG
  • 61
  • 7
1
vote
1 answer

XML Feed get print values

Here is my feed: http://api.visitmix.com/OData.svc/Sessions(guid'816995df-b09a-447a-9391-019512f643a0') Building Web Applications with Microsoft SQL Azure SQL Azure…
CLiown
  • 13,665
  • 48
  • 124
  • 205
1
vote
1 answer

How to extract media:* namespace values in XML?

I need to extract three things from each item of an XML RSS feed from Zazzle's API. Here is the feed: https://feed.zazzle.com/cityofhoops/rss I need to get the title, price, thumbnail, and guid (link) from each item and add it to an array. I plan to…
r3wt
  • 4,642
  • 2
  • 33
  • 55
1
vote
2 answers

Bizarre "@namespace" and styling information in XML document

I am getting an XML document like this: @namespace html url(http://www.w3.org/1999/xhtml); :root { font:small Verdana; font-wei.... huge list of styling ... That second line seems to be…
Greg Rudd
  • 13
  • 2
1
vote
3 answers

Using xPath to access values of simpleXML

I have a XML object result from my database containing settings. I am trying to access the values for a particular settingName: SimpleXMLElement Object ( [settings] => Array ( [0] => SimpleXMLElement Object ( …
SBB
  • 8,560
  • 30
  • 108
  • 223
1
vote
1 answer

PHP SimpleXML - Node no longer exists when unsetting nodes in a foreach loop

I have SimpleXML objects containing items, which have non-unique ID's and versions to accompany them. What I am trying to do is remove old versions of the same ID's. Here is a rough XML mockup:
Nikita240
  • 1,377
  • 2
  • 14
  • 29
1
vote
1 answer

Parse XML value based on attribute

English description
Iztok
  • 77
  • 2
  • 8
1
vote
3 answers

Parsing xml with simplexml_load

I am trying to parse an xml but I get a problem while I am trying to fetch image url. My xml is: The Title http://example.com/post/367327.html Some extra text
Irene T.
  • 1,393
  • 2
  • 20
  • 40
1
vote
1 answer

XML - merge multiple rows into one

I need some assistance with the following issue. I have an xml file with the following structure:
Clain Alexandru
  • 135
  • 2
  • 9