simplexml


PHP - SimpleXML not returning object


I'm pretty stuck here on getting SimpleXML to return an object when I parse it a string that's part of an objects array.
$a = '<?xml version="1.0" encoding="ISO-8859-1"?><BroadsoftDocument protocol="OCI" xmlns="C" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><sessionId xmlns="">1145869290</sessionId><command echo="" xsi:type="UserCallForwardingAlwaysGetResponse" xmlns=""><isActive>false</isActive><forwardToPhoneNumber>43</forwardToPhoneNumber><isRingSplashActive>false</isRingSplashActive></command></BroadsoftDocument>';
$resultA = simplexml_load_string($a);
var_dump($resultA);
$b = $this->_request->_response->_body; // This is the same content as $a and is a string.
$resultB = simplexml_load_string($b);
var_dump($resultB);
The output of $resultA is an object with warning:
Warning: simplexml_load_string(): namespace warning : xmlns: URI C is not absolute in /var/www/html/Broadworks.php on line 103
The output of $resultB is a empty object?
Both $a and $b are the same strings.
remove xmlns="C" from your xml string

Related Links

PHP SimpleXML Load File with Null elements
Iterating through and editing a SimpleXML object by reference in PHP
Simplexml Insert into sub element
warning: simplexml_load_file(): I/O warning : failed to load external entity drupal [closed]
What's wrong with this code? SimpleXMLElement [closed]
Get children attributes using simplexml
Select attribute in simplexml
Save formatted xml
SimpleXML (Zend_Config_Xml actually) and foreach : which tag am I iterating?
simplexml_load_file() error happening in only localhost/xampp
SimpleXml tar.gz
simplexml_load_file error in PHP 5.3
simplexml_load_file not a valid URI issue
Can't turn XML response into an simplexml object
Having trouble getting Fogbugz API response into a SimpleXML object
Upgraded to php 5.3.10 and simpleXMLelement is broken

Categories

HOME
urbancode
server
ngrx
heroku
push-notification
layout
stock
hp-exstream
raspberry-pi
tesseract
android-4.4-kitkat
elm
maven-3
ezpublish
onelogin
n-gram
size
orchardcms
quartz-scheduler
uitypeeditor
footer
invantive-sql
openedx
google-pagespeed
nodatime
jtextfield
object-detection
java-3d
web-sql
sylius
crystal-reports-2010
one-to-many
status
selectedindexchanged
nhapi
fifo
ping
compatibility
skia
bosh
oracle-fusion-middleware
create-table
karaf
calibre
vsts-build-task
mapdb
serve
qwerty
unspecified
sqlite2
user-controls
mesos-chronos
http-live-streaming
password-encryption
outlook-api
http-redirect
import-from-excel
apple-news
dotcover
youcompleteme
hibernate-tools
filepicker
atomicity
boost-multi-index
clean-architecture
python-webbrowser
nstextview
brightcove
nodebb
dynamics-sl
redundancy
pycaffe
vmware-tools
probability-density
thrust
hexdump
bluegiga
tform
reactive-banana
icu4j
content-length
myo
sankey-diagram
angular-local-storage
nsmutabledictionary
gadt
tt-news
angularjs-ng-click
asp.net-web-api-odata
meteor-velocity
industrial
ccss
spring-io
gridcontrol
kyotocabinet
free-variable
gdata-api
parametric-equations
custom-backend
hirefire
blackberry-playbook
horizontal-accordion
javax.script
sql-server-profiler
iphone-web-app
gamequery
preference
commodore

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App