Fix #5: Be opinionated and show namespace URIs rather than prefixes
This commit is contained in:
parent
6ac7c40043
commit
16622d96f3
4 changed files with 14 additions and 12 deletions
|
@ -159,12 +159,14 @@ function _simplexml_tree_recursively_process_node($item, $depth, $include_string
|
|||
// If things are in the current namespace, display them a bit differently
|
||||
$is_current_namespace = ( $ns_uri == reset($item_ns) );
|
||||
|
||||
$ns_uri_quoted = (strlen($ns_uri) == 0 ? 'null' : "'$ns_uri'");
|
||||
|
||||
if ( count($attributes) > 0 )
|
||||
{
|
||||
if ( ! $is_current_namespace )
|
||||
{
|
||||
$dump .= str_repeat($indent, $depth)
|
||||
. "->attributes('$ns_alias', true)" . PHP_EOL;
|
||||
. "->attributes($ns_uri_quoted)" . PHP_EOL;
|
||||
}
|
||||
|
||||
foreach ( $attributes as $sx_attribute )
|
||||
|
@ -219,7 +221,7 @@ function _simplexml_tree_recursively_process_node($item, $depth, $include_string
|
|||
else
|
||||
{
|
||||
$dump .= str_repeat($indent, $depth)
|
||||
. "->children('$ns_alias', true)" . PHP_EOL;
|
||||
. "->children($ns_uri_quoted)" . PHP_EOL;
|
||||
$display_depth = $depth + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SimpleXML object (1 item)
|
||||
[0] // <movies>
|
||||
->children('', true)
|
||||
->children('https://github.com/IMSoP/simplexml_debug')
|
||||
->movie[0]
|
||||
->title[0]
|
||||
->characters[0]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SimpleXML object (1 item)
|
||||
[0] // <movies>
|
||||
->children('test', true)
|
||||
->children('https://github.com/IMSoP/simplexml_debug')
|
||||
->movie[0]
|
||||
->title[0]
|
||||
->characters[0]
|
||||
|
@ -14,8 +14,8 @@ SimpleXML object (1 item)
|
|||
->great-lines[0]
|
||||
->line[0]
|
||||
->rating[0]
|
||||
->attributes('', true)
|
||||
->attributes(null)
|
||||
->type
|
||||
->rating[1]
|
||||
->attributes('', true)
|
||||
->attributes(null)
|
||||
->type
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
SimpleXML object (1 item)
|
||||
[0] // <soap:Envelope>
|
||||
->children('soap', true)
|
||||
->children('http://schemas.xmlsoap.org/soap/envelope/')
|
||||
->Header[0]
|
||||
->children('s', true)
|
||||
->children('http://example.org/security')
|
||||
->credentials[0]
|
||||
->children('', true)
|
||||
->children(null)
|
||||
->username[0]
|
||||
->password[0]
|
||||
->Body[0]
|
||||
->children('tns', true)
|
||||
->children('http://example.org/some-soap-service')
|
||||
->DoSomething[0]
|
||||
->children('', true)
|
||||
->children(null)
|
||||
->from[0]
|
||||
->to[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue