/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] problem with simpleXML

Hi there,

I am trying to make this little bit of code work

[code=php]
$string = <<<XML
<blogEntries xmlns:blog=”http://locahost/docs/”>
<blog:entry>
<blog:title>Sencond main test</blog:title>
<blog:topic>other</blog:topic>
<blog:subTopic>just another test to see what happens</blog:subTopic>
<blog:author>kenn</blog:author>
<blog:date>2008-07-30</blog:date>
<blog:text>This is another test to see what happens. I wonder what it does if I put in some HTML &lt;BR&gt;&lt;BR&gt;

I don’t know if it will screw it up!

LA LA LA

</blog:text>
</blog:entry>
</blogEntries>
XML;

$xml = new SimpleXMLElement($string);
var_dump($xml);

[/code]

however no matter what when I do a var_dump I get this.

[CODE]
object(SimpleXMLElement)#1 (0) { }
[/CODE]

I can’t understand why my variable is empty… Any help?

Thanks

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@r0k3tauthorJul 31.2008 — Never mind - Just found the error. It was in the xpath query...

Sorry.
×

Success!

Help @r0k3t spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...