Ejemplo n.º 1
0
 public function startTag($parser, $name, $attributes)
 {
     $this->_parseElementName($name, $nsPrefix, $nsUri, $tagName);
     if ($tagName == 'RDF' && $nsPrefix == 'rdf') {
         return;
     }
     if ($this->_counter < $this->_rdf_parser->getFrom()) {
         return;
     }
     if ($tagName == 'Description' && $nsPrefix == 'rdf') {
         //start of a document:
         $this->_xml .= "\n  <doc>";
         $uri = $attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#:about'];
         //metafields:
         $this->_xml .= "\n    <field name=\"tenant\">" . $this->_rdf_parser->getOpt('tenant') . "</field>";
         $this->_xml .= "\n    <field name=\"collection\">" . $this->_rdf_parser->getOpt('collection') . "</field>";
         $this->_xml .= "\n    <field name=\"uri\">{$uri}</field>";
         $this->_xml .= "\n    <field name=\"uuid\">" . self::uri2uuid($uri) . "</field>";
         //get the entire XML structure:
         $doc = $this->_rdf_parser->getDOMDocument();
         $node = $doc->getElementsByTagName('Description')->item($this->_counter);
         $xml = $doc->saveXml($node);
         $this->_xml .= "\n    <field name=\"xml\"><![CDATA[" . $xml . "]]></field>";
         return;
     }
     if ($nsPrefix == 'skos') {
         //is this a language enabled SKOS class?
         $fieldname = $tagName;
         if (in_array($tagName, self::$langMapping)) {
             if (isset($attributes['http://www.w3.org/XML/1998/namespace:lang'])) {
                 $fieldname = $tagName . '@' . $attributes['http://www.w3.org/XML/1998/namespace:lang'];
             }
         }
         $this->_xml .= "\n    <field name=\"{$fieldname}\">";
         if (isset($attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#:resource'])) {
             $this->_xml .= $attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#:resource'];
             $this->_xml .= '</field>';
         }
     } elseif (in_array($nsPrefix, self::$standardNamespaces)) {
     }
 }