You are here

protected function EasyRdf_Parser_Rdfa::printNode in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rdfa.php \EasyRdf_Parser_Rdfa::printNode()
1 call to EasyRdf_Parser_Rdfa::printNode()
EasyRdf_Parser_Rdfa::processNode in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rdfa.php

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rdfa.php, line 112

Class

EasyRdf_Parser_Rdfa
Class to parse RDFa 1.1 with no external dependancies.

Code

protected function printNode($node, $depth) {
  $indent = str_repeat('  ', $depth);
  print $indent;
  switch ($node->nodeType) {
    case XML_ELEMENT_NODE:
      print 'node';
      break;
    case XML_ATTRIBUTE_NODE:
      print 'attr';
      break;
    case XML_TEXT_NODE:
      print 'text';
      break;
    case XML_CDATA_SECTION_NODE:
      print 'cdata';
      break;
    case XML_ENTITY_REF_NODE:
      print 'entref';
      break;
    case XML_ENTITY_NODE:
      print 'entity';
      break;
    case XML_PI_NODE:
      print 'pi';
      break;
    case XML_COMMENT_NODE:
      print 'comment';
      break;
    case XML_DOCUMENT_NODE:
      print 'doc';
      break;
    case XML_DOCUMENT_TYPE_NODE:
      print 'doctype';
      break;
    case XML_HTML_DOCUMENT_NODE:
      print 'html';
      break;
    default:
      throw new EasyRdf_Exception("unknown node type: " . $node->nodeType);
      break;
  }
  print ' ' . $node->nodeName . "\n";
  if ($node
    ->hasAttributes()) {
    foreach ($node->attributes as $attr) {
      print $indent . ' ' . $attr->nodeName . " => " . $attr->nodeValue . "\n";
    }
  }
}