Skip to content
Advertisement

Tag: simplexml

PHP Split XML based on multiple nodes

I honestly tried to find a solution for php, but a lot of threads sound similar, but are not applicable for me or are for completely different languages. I want to split an xml file based on nodes. Ideally multiple nodes, but of course one is enough and could be applied multiple times. e.g. I want to split this by

Sanitize an external xml file with php

Here’s my problem: Essentially I need to use an XML file from an external source and loop it through to display nicely some data. I created a function that gets content from the external URL (file_get_contents), then I turn the string of XML into an object (I use LIBXML_NOCDATA as a parameter because it contains ), right after I turn

Modify data extracted from rss file with simplexml

I am extracting data from an rss file using simplexml. The urls in are wrong and I am trying to change them. To be able to use the data, I need to strip everything before the word “base” in those urls. I can do it with the following: but its looks messy and I’m pretty sure there is a way

PHP simpleXMLelment xpath returns unexpected results

I have executed the following code on the the sample XML at the bottom of the question and I am getting unexpected results. I would expect this to return only the two record nodes that are children of the current addresses node. But, it actually returns all 5 of the record nodes of the original $xml element. Everything I have

Parsing SimpleXML Object data

How to get “file_url” from this data? Response can contain few objects, and how to parse it? Code that I use: Response: Please help! (don’t ask why I parsing rule34) Answer Hi You can conver it to the array and work with is easy

Retrieve OuterXML From XML Child Node

I need to retrieve the OuterXML for each speak tag. For example, I need to retrieve this data for the first speak tag in test.ssml: index.php test.ssml all tracks.mp3 bookmarks.dat Test 1 Test 2 Current Output in Browser Desired Output Answer You can get the XML directly using the SimpleXML function asXML() and don’t need (as far as I can

How can I show XML external entities in a php page?

I am currently working on a little library project using XML to define books, and php to do a search using title/author then showing that specific book in the browser. So I made a bunch of books in XML files, then linked those files as external entities in my main XML file. I used a DTD to define the entities,

Advertisement