3,933 questions
1
vote
1
answer
90
views
XML parsing error due to control characters
I keep getting a control character error at irregular intervals when calling cUrl via XML. I would like to fix this, but the source doesn't currently have a control character error, and I don't have ...
1
vote
2
answers
115
views
Get last value of a sub-node in XML parsed by PHP into an array
I am trying to parse an Atom XML feed using PHP. It is for an ebook publisher. All is well, except I cannot work out how to extract the last "subject" tag for each entry: that is the ...
1
vote
2
answers
67
views
SimpleXMLElement XML displays as plain text after CI3 to CI4 upgrade
I am upgrading a page from CI3 to CI4. The page has a button to open a new tab which displays XML data. For some reason the CI4 version is showing the XML as plain text. I copied the source of each ...
1
vote
1
answer
44
views
Using SimpleXML XPath To Find 'Or' Conditional Value
I am working on expanding my current SimpleXML XPath to include an 'or' condition.
Here is the original (working) code below, without any 'or' condition.
$strXpathVar = "Scholarship/Research"...
0
votes
1
answer
75
views
How does one print just the values with Simple XML Element? [duplicate]
I was pulling data in from an XML file and it was printing more than the values, whereas I just wanted the values using this code:
<?php
$url = 'site.com';
$result = file_get_contents($url, false);...
0
votes
2
answers
72
views
Difficulties in extracting content from a SimpleXMLElement
I have this XML:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault&...
1
vote
1
answer
90
views
PHP addChild function misssing the namespace from the xml
Hoping someone can shed some light on why this is happening.
I've used the exact same syntax elsewhere in my code without any issues, but for some reason this isn't working:
$sale = $xml->addChild('...
-1
votes
1
answer
31
views
How do i parse xml to get the value of the child element
The Xml data I have is:
<?xml version="1.0" encoding="UTF-8"?>
<var>
<packid>27441</packid>
<clientid>1426</clientid>
<desc>PO: ...
0
votes
0
answers
19
views
SimpleXML Attributes Inconsistent [duplicate]
I have the below XML in an external file:
<?xml version="1.0" encoding="UTF-8"?>
<propertyList date="2024-08-27-10:09:55">
<residential modTime="...
0
votes
1
answer
123
views
Find Version of XPath in Simple XML for PHP
I am working in PHP and using SimpleXML and XPath.
Is there a way to find which version of XPath is included with SimpleXML/PHP?
Also, is the version of XPath used with SimpleXML the "full ...
1
vote
1
answer
72
views
Create new file with XML data from original file based on criteria
On the page I have it loading content from an XML file.
There is then a form which displays entries from this XML file based on the category name matching the $_GET['cat'] value.
The form then allows ...
0
votes
0
answers
36
views
PHP SimpleXML does not parse array of nodes correctly [duplicate]
I have an XML with an list of nodes of the same name:
<object>
<attributes>
<attribute id="1" name="first">First Value</attribute>
<...
0
votes
0
answers
39
views
PHP simplexml how to print attributes of child nodes
How do I print the attributes of all data nodes that are under staff?
values.xml
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<data name="region1">...
1
vote
0
answers
50
views
Type of non existent SimpleXMLElements
Can you explain me the reason why SimpleXMLElement returns an empty object for non-existent XML-elements on the first level, but not for any layer below?
See this code:
$xml = simplexml_load_string('&...
0
votes
2
answers
162
views
Read XML feed with PHP [closed]
I have a problem with I trying to read and parse this feed:
Some XML Feed
for some reason the function SimpleXMLElement returns empty nodes. I am using file_get_contents to read the URL and then ...