|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-17 07:01 UTC] chregu@php.net
[2007-08-17 14:35 UTC] cpriest at warpmail dot net
[2007-08-17 14:45 UTC] rrichards@php.net
[2007-08-17 16:30 UTC] cpriest at warpmail dot net
[2007-08-17 19:52 UTC] rrichards@php.net
[2007-08-18 04:42 UTC] cpriest at warpmail dot net
[2007-08-18 09:48 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 10:00:02 2025 UTC |
Description: ------------ SimpleXML is having some difficulty in parsing XML which contains a default xmlns entry. Reproduce code: --------------- <? header('Content-Type: text/plain'); $ResponseBody = '<?xml version="1.0" encoding="UTF-8"?> <result xmlns="https://zzz.com/webservices" xmlns:xsd="https://www.w3.org/2001/XMLSchema" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">Test</result>'; $objXML = new SimpleXMLElement($ResponseBody); $tMatches = $objXML->xpath('/result'); print_r((string)$tMatches[0]); ?> Expected result: ---------------- Expect print_r() to print "Test" Actual result: -------------- $tMatches is an empty array() If you change the xmlns="https://zzz.com/webservices" to xmlns:zzz="https://zzz.com/webservices" (add a namespace sub-string), it works fine.