0

I encountered a problem with simplexml_load_string() returns only first attribute. Input is like this:

<xsl:stylesheet version="1.0"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:res="{REQUEST_URI}"
                xmlns:php="http://php.net/xsl"
    >
  <xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified"
             version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN"
             xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
    <blabla>
          <foo>uiop</foo>
          <bar>qwerty</bar>
    </blabla>
  </xs:schema>
</xsl:stylesheet>

Result:

[@attributes] => Array
                (
                    [Version] => 1.0
                )

But I need in whole document parsing.

  • Can you show us the input document and the code that generated that output? – joadha Jan 29 '14 at 20:07
  • @joadha Output displayed by IDE Eclipse. Code: '$xml = simplexml_load_string($xmlSource);'. Input document is a little bit privy. But there's nothing special, so I've updated my question. – Andrey Danilov Jan 29 '14 at 20:18
  • 1
    Problem is the rest of the attributes are namespaced. Read this: http://stackoverflow.com/questions/595946/parse-xml-with-namespace-using-simplexml – Sergiu Paraschiv Jan 29 '14 at 20:20

0 Answers0