SimpleXMLElement::getDocNamespaces ドキュメントで宣言されている名前空間を返す &reftitle.description; public arrayfalseSimpleXMLElement::getDocNamespaces boolrecursive&false; boolfromRoot&true; ドキュメントで宣言されている名前空間を返します。 &reftitle.parameters; recursive 指定されている場合は、親ノードおよび子ノードで宣言されている全ての名前空間を返します。 されていない場合は、ルートノードで宣言されている名前空間のみを返します。 fromRoot XML 文書のルートノードからでなく、子ノードの配下の名前空間を再帰的にチェックできるようにします。 &reftitle.returnvalues; getDocNamespaces メソッドは、 名前空間名および関連付けられた URI を配列で返します。 &reftitle.examples; ドキュメントの名前空間の取得 John Doe Susie Q. Public XML; $sxe = new SimpleXMLElement($xml); $namespaces = $sxe->getDocNamespaces(); var_dump($namespaces); ?> ]]> &example.outputs; string(21) "http://example.org/ns" } ]]> 複数の名前空間での動作 John Doe Susie Q. Public XML; $sxe = new SimpleXMLElement($xml); $namespaces = $sxe->getDocNamespaces(TRUE); var_dump($namespaces); ?> ]]> &example.outputs; string(21) "http://example.org/ns" ["t"]=> string(23) "http://example.org/test" ["a"]=> string(23) "http://example.org/addr" } ]]> &reftitle.seealso; SimpleXMLElement::getNamespaces SimpleXMLElement::registerXPathNamespace