Skip to content

Instantly share code, notes, and snippets.

@salathe
Created April 26, 2012 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salathe/2499678 to your computer and use it in GitHub Desktop.
Save salathe/2499678 to your computer and use it in GitHub Desktop.
New DOM debug output in PHP 5.4.1
<?php
$doc = new DOMDocument();
$doc->loadXML('<example a="b">Test</example>');
$el = $doc->documentElement;
$at = $el->getAttributeNode('a');
$tx = $el->firstChild;
var_dump($doc);
var_dump($el);
var_dump($at);
var_dump($tx);
object(DOMDocument)#1 (0) {
}
object(DOMElement)#2 (0) {
}
object(DOMAttr)#3 (0) {
}
object(DOMText)#4 (0) {
}
object(DOMDocument)#1 (34) {
["doctype"]=>
NULL
["implementation"]=>
string(22) "(object value omitted)"
["documentElement"]=>
string(22) "(object value omitted)"
["actualEncoding"]=>
NULL
["encoding"]=>
NULL
["xmlEncoding"]=>
NULL
["standalone"]=>
bool(true)
["xmlStandalone"]=>
bool(true)
["version"]=>
string(3) "1.0"
["xmlVersion"]=>
string(3) "1.0"
["strictErrorChecking"]=>
bool(true)
["documentURI"]=>
string(1) "/"
["config"]=>
NULL
["formatOutput"]=>
bool(false)
["validateOnParse"]=>
bool(false)
["resolveExternals"]=>
bool(false)
["preserveWhiteSpace"]=>
bool(true)
["recover"]=>
bool(false)
["substituteEntities"]=>
bool(false)
["nodeName"]=>
string(9) "#document"
["nodeValue"]=>
NULL
["nodeType"]=>
int(9)
["parentNode"]=>
NULL
["childNodes"]=>
string(22) "(object value omitted)"
["firstChild"]=>
string(22) "(object value omitted)"
["lastChild"]=>
string(22) "(object value omitted)"
["previousSibling"]=>
NULL
["attributes"]=>
NULL
["ownerDocument"]=>
NULL
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
NULL
["baseURI"]=>
string(1) "/"
["textContent"]=>
string(4) "Test"
}
object(DOMElement)#2 (17) {
["tagName"]=>
string(7) "example"
["schemaTypeInfo"]=>
NULL
["nodeName"]=>
string(7) "example"
["nodeValue"]=>
string(4) "Test"
["nodeType"]=>
int(1)
["parentNode"]=>
string(22) "(object value omitted)"
["childNodes"]=>
string(22) "(object value omitted)"
["firstChild"]=>
string(22) "(object value omitted)"
["lastChild"]=>
string(22) "(object value omitted)"
["previousSibling"]=>
NULL
["attributes"]=>
string(22) "(object value omitted)"
["ownerDocument"]=>
string(22) "(object value omitted)"
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
string(7) "example"
["baseURI"]=>
string(1) "/"
["textContent"]=>
string(4) "Test"
}
Warning: var_dump(): Not yet implemented in <file> on line <line>
object(DOMAttr)#3 (20) {
["name"]=>
string(1) "a"
["specified"]=>
bool(true)
["value"]=>
string(1) "b"
["ownerElement"]=>
string(22) "(object value omitted)"
["schemaTypeInfo"]=>
NULL
["nodeName"]=>
string(1) "a"
["nodeValue"]=>
string(1) "b"
["nodeType"]=>
int(2)
["parentNode"]=>
string(22) "(object value omitted)"
["childNodes"]=>
string(22) "(object value omitted)"
["firstChild"]=>
string(22) "(object value omitted)"
["lastChild"]=>
string(22) "(object value omitted)"
["previousSibling"]=>
NULL
["attributes"]=>
NULL
["ownerDocument"]=>
string(22) "(object value omitted)"
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
string(1) "a"
["baseURI"]=>
string(1) "/"
["textContent"]=>
string(1) "b"
}
object(DOMText)#4 (18) {
["wholeText"]=>
string(4) "Test"
["data"]=>
string(4) "Test"
["length"]=>
int(4)
["nodeName"]=>
string(5) "#text"
["nodeValue"]=>
string(4) "Test"
["nodeType"]=>
int(3)
["parentNode"]=>
string(22) "(object value omitted)"
["childNodes"]=>
NULL
["firstChild"]=>
NULL
["lastChild"]=>
NULL
["previousSibling"]=>
NULL
["attributes"]=>
NULL
["ownerDocument"]=>
string(22) "(object value omitted)"
["namespaceURI"]=>
NULL
["prefix"]=>
string(0) ""
["localName"]=>
NULL
["baseURI"]=>
string(1) "/"
["textContent"]=>
string(4) "Test"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment