1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| <?php
class debugXMLReader extends XMLReader {
/**
* This is a table to translate a node type verbosely.
* @var array
*/
public $aNodeTypes = array (
0=>"No node type",
1=>"Start element",
2=>"Attribute node",
3=>"Text node",
4=>"CDATA node",
5=>"Entity Reference node",
6=>"Entity Declaration node",
7=>"Processing Instruction node",
8=>"Comment node",
9=>"Document node",
10=>"Document Type node",
11=>"Document Fragment node",
12=>"Notation node",
13=>"Whitespace node",
14=>"Significant Whitespace node",
15=>"End Element",
16=>"End Entity",
17=>"XML Declaration node"
);
/**
* Returns a complete debugging array with all current's node info.
* @return array Returns an array with all current's node info.
*/
public function dump() {
$dump = array();
$dump['attributeCount'] = $this->attributeCount;
$dump['baseURI'] = $this->baseURI;
$dump['depth'] = $this->depth;
$dump['hasAttributes'] = $this->hasAttributes ? 'TRUE' : 'FALSE';
$dump['hasValue'] = $this->hasValue ? 'TRUE' : 'FALSE';
$dump['isDefault'] = $this->isDefault ? 'TRUE' : 'FALSE';
$dump['isEmptyElement'] = @$this->isEmptyElement ? 'TRUE' : 'FALSE';
$dump['localName'] = $this->localName;
$dump['name'] = $this->name;
$dump['namespaceURI'] = $this->namespaceURI;
$dump['nodeType'] = $this->nodeType;
$dump['nodeTypeVerbose'] = $this->aNodeTypes[$this->nodeType];
$dump['namespaceURI'] = $this->namespaceURI;
$dump['prefix'] = $this->prefix;
$dump['value'] = $this->value;
$dump['xmlLang'] = $this->xmlLang;
return $dump;
}
}
?> |
Partager