You are here

protected function EasyRdf_Parser_RdfXml::endState6 in Zircon Profile 8

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

@ignore

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

File

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

Class

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

Code

protected function endState6($t) {
  if ($s = $this
    ->getParentS()) {
    $l = isset($s['p_x_lang']) && $s['p_x_lang'] ? $s['p_x_lang'] : (isset($s['x_lang']) ? $s['x_lang'] : null);
    $data = $s['o_xml_data'];
    $level = $s['o_xml_level'];
    if ($level === 0) {

      /* pClose */
      $this
        ->add($s['value'], $s['p'], trim($data, ' '), $s['type'], 'literal', $this->rdf . 'XMLLiteral', $l);
      unset($s['o_xml_data']);
      $this->state = 2;
    }
    else {
      $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 . '>';
      }
      $s['o_xml_data'] = $data;
      $s['o_xml_level'] = $level - 1;
      if ($t == $s['p']) {

        /* xml container prop */
        $s['p_xml_literal_level']--;
      }
    }
    $this
      ->updateS($s);
  }
}