You are here

protected function EasyRdf_Parser_RdfXml::startState6 in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/RdfXml.php \EasyRdf_Parser_RdfXml::startState6()

@ignore

1 call to EasyRdf_Parser_RdfXml::startState6()
EasyRdf_Parser_RdfXml::startElementHandler in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/RdfXml.php
@ignore

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/RdfXml.php, line 538

Class

EasyRdf_Parser_RdfXml
A pure-php class to parse RDF/XML.

Code

protected function startState6($t, $a) {
  $s = $this
    ->getParentS();
  $data = isset($s['o_xml_data']) ? $s['o_xml_data'] : '';
  $ns = isset($s['ns']) ? $s['ns'] : array();
  $parts = $this
    ->splitURI($t);
  if (count($parts) === 1) {
    $data .= '<' . $t;
  }
  else {
    $nsUri = $parts[0];
    $name = $parts[1];
    if (!isset($this->nsp[$nsUri])) {
      foreach ($this->nsp as $tmp1 => $tmp2) {
        if (strpos($t, $tmp1) === 0) {
          $nsUri = $tmp1;
          $name = substr($t, strlen($tmp1));
          break;
        }
      }
    }
    $nsp = isset($this->nsp[$nsUri]) ? $this->nsp[$nsUri] : '';
    $data .= $nsp ? '<' . $nsp . ':' . $name : '<' . $name;

    /* ns */
    if (!isset($ns[$nsp . '=' . $nsUri]) || !$ns[$nsp . '=' . $nsUri]) {
      $data .= $nsp ? ' xmlns:' . $nsp . '="' . $nsUri . '"' : ' xmlns="' . $nsUri . '"';
      $ns[$nsp . '=' . $nsUri] = true;
      $s['ns'] = $ns;
    }
  }
  foreach ($a as $k => $v) {
    $parts = $this
      ->splitURI($k);
    if (count($parts) === 1) {
      $data .= ' ' . $k . '="' . $v . '"';
    }
    else {
      $nsUri = $parts[0];
      $name = $parts[1];
      $nsp = isset($this->nsp[$nsUri]) ? $this->nsp[$nsUri] : '';
      $data .= $nsp ? ' ' . $nsp . ':' . $name . '="' . $v . '"' : ' ' . $name . '="' . $v . '"';
    }
  }
  $data .= '>';
  $s['o_xml_data'] = $data;
  $s['o_xml_level'] = isset($s['o_xml_level']) ? $s['o_xml_level'] + 1 : 1;
  if ($t == $s['p']) {

    /* xml container prop */
    $s['p_xml_literal_level'] = isset($s['p_xml_literal_level']) ? $s['p_xml_literal_level'] + 1 : 1;
  }
  $this
    ->updateS($s);
}