当前位置: 首页>>代码示例>>PHP>>正文


PHP XMLReader::readInnerXML方法代码示例

本文整理汇总了PHP中XMLReader::readInnerXML方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLReader::readInnerXML方法的具体用法?PHP XMLReader::readInnerXML怎么用?PHP XMLReader::readInnerXML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XMLReader的用法示例。


在下文中一共展示了XMLReader::readInnerXML方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setParentIfAvailable

 /**
  * Set the parent element if there is one.
  *
  * @return void
  */
 public function setParentIfAvailable()
 {
     if (!$this->process->readInnerXML()) {
         return;
     }
     $this->parents[] = $this->name();
 }
开发者ID:pandaac,项目名称:exporter,代码行数:12,代码来源:Reader.php

示例2: main

function main()
{
    var_dump(stream_wrapper_register('strstream', 'StringWrapper'));
    $r = new XMLReader();
    $r->open("strstream://");
    var_dump($r->read());
    var_dump($r->readOuterXML());
    var_dump($r->readInnerXML());
    var_dump($r->read());
    var_dump($r->readOuterXML());
    var_dump($r->readInnerXML());
}
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:xmlreader_user_stream.php

示例3: parseSparqlResults

 /**
  * Parse the passed in Sparql XML string into a more easily usable format.
  *
  * @param string $sparql
  *   A string containing Sparql result XML.
  *
  * @return array
  *   Indexed (numerical) array, containing a number of associative arrays,
  *   with keys being the same as the variable names in the query.
  *   URIs beginning with 'info:fedora/' will have this beginning stripped
  *   off, to facilitate their use as PIDs.
  */
 public static function parseSparqlResults($sparql)
 {
     // Load the results into a XMLReader Object.
     $xmlReader = new XMLReader();
     $xmlReader->xml($sparql);
     // Storage.
     $results = array();
     // Build the results.
     while ($xmlReader->read()) {
         if ($xmlReader->localName === 'result') {
             if ($xmlReader->nodeType == XMLReader::ELEMENT) {
                 // Initialize a single result.
                 $r = array();
             } elseif ($xmlReader->nodeType == XMLReader::END_ELEMENT) {
                 // Add result to results
                 $results[] = $r;
             }
         } elseif ($xmlReader->nodeType == XMLReader::ELEMENT && $xmlReader->depth == 3) {
             $val = array();
             $uri = $xmlReader->getAttribute('uri');
             if ($uri !== NULL) {
                 $val['value'] = self::pidUriToBarePid($uri);
                 $val['uri'] = (string) $uri;
                 $val['type'] = 'pid';
             } else {
                 //deal with any other types
                 $val['type'] = 'literal';
                 $val['value'] = (string) $xmlReader->readInnerXML();
             }
             $r[$xmlReader->localName] = $val;
         }
     }
     $xmlReader->close();
     return $results;
 }
开发者ID:MarmotLibraryNetwork,项目名称:islandora_import,代码行数:47,代码来源:RepositoryQuery.php

示例4: readXml

 /**
  * Read an XML snippet from an element
  *
  * @param string $metafield Field that we will fill with the result
  * @throws MWException
  */
 private function readXml($metafield = null)
 {
     $this->debug("Read top level metadata");
     if (!$metafield || $this->reader->nodeType != XMLReader::ELEMENT) {
         return;
     }
     // @todo Find and store type of xml snippet. metadata['metadataType'] = "rdf"
     if (method_exists($this->reader, 'readInnerXML')) {
         $this->metadata[$metafield] = trim($this->reader->readInnerXML());
     } else {
         throw new MWException("The PHP XMLReader extension does not come " . "with readInnerXML() method. Your libxml is probably out of " . "date (need 2.6.20 or later).");
     }
     $this->reader->next();
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:20,代码来源:SVGMetadataExtractor.php

示例5: export

 public function export($v92ec19ffde05e15769b1bb3ee05ad745)
 {
     set_time_limit(0);
     if (!count($v92ec19ffde05e15769b1bb3ee05ad745)) {
         $v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
         $v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page(0)->childs(0);
         $v92ec19ffde05e15769b1bb3ee05ad745 = $v8be74552df93e31bbdd6b36ed74bdb6a->result;
     }
     if (getRequest('as_file') === '0') {
         $ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($this->getSourceName());
         $ved780287e302ec3b9fd3c5e78771919f->addBranches($v92ec19ffde05e15769b1bb3ee05ad745);
         $result = $ved780287e302ec3b9fd3c5e78771919f->execute();
         return $result->saveXML();
     }
     $v857a5246dff0c3c79e476b004684f6d3 = "./sys-temp/export/";
     $vb80bb7740288fda1f201890375a60c8f = getRequest('param0');
     $v97fd815a3803a0588876bdd862014fed = $v857a5246dff0c3c79e476b004684f6d3 . $vb80bb7740288fda1f201890375a60c8f . "." . parent::getFileExt();
     $v6990a54322d9232390a784c5c9247dd6 = $v857a5246dff0c3c79e476b004684f6d3 . $vb80bb7740288fda1f201890375a60c8f;
     if (!is_dir($v6990a54322d9232390a784c5c9247dd6)) {
         mkdir($v6990a54322d9232390a784c5c9247dd6, 0777, true);
     }
     if (file_exists($v97fd815a3803a0588876bdd862014fed) && !file_exists(CURRENT_WORKING_DIR . '/sys-temp/runtime-cache/' . md5($this->getSourceName()))) {
         unlink($v97fd815a3803a0588876bdd862014fed);
     }
     if ($v92ec19ffde05e15769b1bb3ee05ad745) {
         $v33030abc929f083da5f6c3f755b46034 = array('./tpls/', './xsltTpls/', './css/', './js/', './usels/', './umaps/', './templates/');
         foreach ($v33030abc929f083da5f6c3f755b46034 as $v100664c6e2c0333b19a729f2f3ddb7dd) {
             if (is_dir($v100664c6e2c0333b19a729f2f3ddb7dd)) {
                 $v736007832d2167baaae763fd3a3f3cf1 = new umiDirectory($v100664c6e2c0333b19a729f2f3ddb7dd);
                 $v45b963397aa40d4a0063e0d85e4fe7a1 = $v736007832d2167baaae763fd3a3f3cf1->getAllFiles(1);
                 foreach ($v45b963397aa40d4a0063e0d85e4fe7a1 as $vd6fe1d0be6347b8ef2427fa629c04485 => $vb068931cc450442b63f5b3d276ea4297) {
                     $v8c7dd922ad47494fc02c388e12c00eac = new umiFile($vd6fe1d0be6347b8ef2427fa629c04485);
                     if (!is_dir($v6990a54322d9232390a784c5c9247dd6 . ltrim($v8c7dd922ad47494fc02c388e12c00eac->getDirName(), '.'))) {
                         mkdir($v6990a54322d9232390a784c5c9247dd6 . ltrim($v8c7dd922ad47494fc02c388e12c00eac->getDirName(), '.'), 0777, true);
                     }
                     copy($v8c7dd922ad47494fc02c388e12c00eac->getFilePath(), $v6990a54322d9232390a784c5c9247dd6 . $v8c7dd922ad47494fc02c388e12c00eac->getFilePath(true));
                 }
             }
         }
     }
     $v71b70dd1e455c477220693d84ccd5682 = $v97fd815a3803a0588876bdd862014fed . '.tmp';
     $v480d1b61a0432d1319f7504a3d7318dd = (int) mainConfiguration::getInstance()->get("modules", "exchange.export.limit");
     if ($v480d1b61a0432d1319f7504a3d7318dd <= 0) {
         $v480d1b61a0432d1319f7504a3d7318dd = 25;
     }
     $ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($this->getSourceName(), $v480d1b61a0432d1319f7504a3d7318dd);
     $ved780287e302ec3b9fd3c5e78771919f->addBranches($v92ec19ffde05e15769b1bb3ee05ad745);
     $vdd988cfd769c9f7fbd795a0f5da8e751 = $ved780287e302ec3b9fd3c5e78771919f->execute();
     if (file_exists($v97fd815a3803a0588876bdd862014fed)) {
         $v1de9b0a30075ae8c303eb420c103c320 = new XMLReader();
         $va82feee3cc1af8bcabda979e8775ef0f = new XMLWriter();
         $v1de9b0a30075ae8c303eb420c103c320->open($v97fd815a3803a0588876bdd862014fed);
         $va82feee3cc1af8bcabda979e8775ef0f->openURI($v71b70dd1e455c477220693d84ccd5682);
         $va82feee3cc1af8bcabda979e8775ef0f->startDocument('1.0', 'utf-8');
         $va82feee3cc1af8bcabda979e8775ef0f->startElement('umidump');
         $va82feee3cc1af8bcabda979e8775ef0f->writeAttribute('version', '2.0');
         $va82feee3cc1af8bcabda979e8775ef0f->writeAttribute('xmlns:xlink', 'http://www.w3.org/TR/xlink');
         $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->read();
         while ($v7aa28ed115707345d0274032757e8991) {
             if ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::ELEMENT) {
                 $ve24455211a964330063a18670d943835 = $v1de9b0a30075ae8c303eb420c103c320->name;
                 if ($ve24455211a964330063a18670d943835 != 'umidump') {
                     $va82feee3cc1af8bcabda979e8775ef0f->startElement($ve24455211a964330063a18670d943835);
                     if ($ve24455211a964330063a18670d943835 != 'meta') {
                         if (!$v1de9b0a30075ae8c303eb420c103c320->isEmptyElement) {
                             $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->read();
                             while ($v7852ddca47412c0d947ebf27eb83ed3a) {
                                 if ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::ELEMENT) {
                                     $vcf7f5c76225a101e6320a96c02f92fc1 = $v1de9b0a30075ae8c303eb420c103c320->name;
                                     $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($v1de9b0a30075ae8c303eb420c103c320->readOuterXML());
                                     $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->next();
                                 } elseif ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::END_ELEMENT && $v1de9b0a30075ae8c303eb420c103c320->name == $ve24455211a964330063a18670d943835) {
                                     $v7852ddca47412c0d947ebf27eb83ed3a = false;
                                 } else {
                                     $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->next();
                                 }
                             }
                         }
                         if ($vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName($ve24455211a964330063a18670d943835)->item(0)->hasChildNodes()) {
                             $v268184c12df027f536154d099d497b31 = $vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName($ve24455211a964330063a18670d943835)->item(0)->childNodes;
                             foreach ($v268184c12df027f536154d099d497b31 as $v1b7d5726533ab525a8760351e9b5e415) {
                                 $va5e171f642af8e3bd24c50cdc4d66fe3 = new DOMDocument();
                                 $va5e171f642af8e3bd24c50cdc4d66fe3->formatOutput = true;
                                 $v36c4536996ca5615dcf9911f068786dc = $va5e171f642af8e3bd24c50cdc4d66fe3->importNode($v1b7d5726533ab525a8760351e9b5e415, true);
                                 $va5e171f642af8e3bd24c50cdc4d66fe3->appendChild($v36c4536996ca5615dcf9911f068786dc);
                                 $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($va5e171f642af8e3bd24c50cdc4d66fe3->saveXML($v36c4536996ca5615dcf9911f068786dc, LIBXML_NOXMLDECL));
                             }
                         }
                     } elseif ($ve24455211a964330063a18670d943835 == 'meta') {
                         $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($v1de9b0a30075ae8c303eb420c103c320->readInnerXML());
                         $v92ec19ffde05e15769b1bb3ee05ad745 = $vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName('branches');
                         if ($v92ec19ffde05e15769b1bb3ee05ad745->item(0)) {
                             $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($vdd988cfd769c9f7fbd795a0f5da8e751->saveXML($v92ec19ffde05e15769b1bb3ee05ad745->item(0), LIBXML_NOXMLDECL));
                         }
                     }
                     $va82feee3cc1af8bcabda979e8775ef0f->fullEndElement();
                     $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->next();
                     continue;
                 }
             }
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:101,代码来源:transferExporter.php

示例6: Time

        $event[eventType] = $x->readString();
    }
    if ($x->localName === 'significance' && $x->nodeType == XMLREADER::ELEMENT) {
        $event[description] .= ". " . $x->readString();
    }
    if ($x->localName === 'timeOfDay' && $x->nodeType == XMLREADER::ELEMENT) {
        $event[description] .= ". Time(s) of day affected: " . $x->readString();
    }
    if ($x->localName === 'trafficImpacts' && $x->nodeType == XMLREADER::ELEMENT) {
        $event[trafficImpactsXML] = "<root>";
        $event[trafficImpactsXML] .= $x->readInnerXml();
        $event[trafficImpactsXML] .= "</root>";
    }
    if ($x->localName === 'locations' && $x->nodeType == XMLREADER::ELEMENT) {
        $event[geoXML] = "<root>";
        $event[geoXML] .= $x->readInnerXML();
        $event[geoXML] .= "</root>";
        $events[] = $event;
    }
}
$x->close();
######## CREATE GEOJSON ######## CREATE GEOJSON ######## CREATE GEOJSON ######
$eventsCount = sizeof($events);
$x2GeoStruct = array();
$x2ImpactStruct = array();
$toBeEncoded1 = array("type" => "FeatureCollection", "features" => []);
for ($i = 0; $i < $eventsCount; $i++) {
    $toBeEncoded1[features][$i] = array("type" => "Feature", "geometry" => ["type" => "null", "coordinates" => []], "properties" => array("id" => $events[$i][id], "location" => "null", "description" => $events[$i][description], "planned" => "null", "alternativeRoute" => "N/A", "eventType" => $events[$i][eventType], "expectedResolution" => "null", "impact" => "null", "locationAreas" => "null", "status" => "null", "eventCreated" => $events[$i][startDate], "eventModified" => $events[$i][lastModified]));
    //function call to XMLStructReader.php script for conversion to struct
    $x2ImpactStruct[] = xml_to_object($events[$i][trafficImpactsXML]);
    $impactCount = sizeof($x2ImpactStruct[$i]->children);
开发者ID:HamishClulee,项目名称:NZRoadInfo,代码行数:31,代码来源:chchTraffic.php

示例7: while

                break;
            default: $formatting['header'] = 0;
                break;
        }

        // open h-tag or paragraph
        $text .= ($formatting['header'] > 0) ? '<h' . $formatting['header'] . '>' : '<p>';
        $status = false;

        // loop through paragraph dom
        while ($paragraph->read()) {

            $node_loc = $paragraph->localName;
            // look for elements
            if ($paragraph->nodeType == XMLREADER::ELEMENT && $paragraph->name === 'w:r') {
                $node = trim($paragraph->readInnerXML());
                //echo $node;
                // add <br> tags
                if (strstr($node, '<w:br '))
                    $text .= '<br>';

                // look for formatting tags                    
                $formatting['bold'] = (strstr($node, '<w:b/>')) ? (($formatting['bold'] == 'closed') ? 'open' : $formatting['bold']) : (($formatting['bold'] == 'opened') ? 'close' : $formatting['bold']);
                $formatting['italic'] = (strstr($node, '<w:i/>')) ? (($formatting['italic'] == 'closed') ? 'open' : $formatting['italic']) : (($formatting['italic'] == 'opened') ? 'close' : $formatting['italic']);
                $formatting['underline'] = (strstr($node, '<w:u ')) ? (($formatting['underline'] == 'closed') ? 'open' : $formatting['underline']) : (($formatting['underline'] == 'opened') ? 'close' : $formatting['underline']);
                $str = $paragraph->expand()->textContent;
                // build text string of doc
                $text .= (($formatting['bold'] == 'open') ? '<strong>' : '') .
                        (($formatting['italic'] == 'open') ? '<em>' : '') .
                        (($formatting['underline'] == 'open') ? '<u>' : '') .
                        //htmlentities(iconv('UTF-8', 'ASCII//TRANSLIT',$paragraph->expand()->textContent)).
开发者ID:HarmonySoftwareSE499,项目名称:VCS_SE499,代码行数:31,代码来源:upload_test_3.php

示例8: _getXmlNode

 /**
  * Process a node from the XML Map
  * It is permitted for the XML to just define one or more tables without fields (when the 'use headers' option is used)
  *
  * Note: Calls itself recursively to process a tree
  *
  * @return bool returns true if all fine else false
  */
 private function _getXmlNode($node_content, $current_record, $xml_path)
 {
     $jinput = JFactory::getApplication()->input;
     $csvilog = $jinput->get('csvilog', null, null);
     $current_node = '';
     $xml_schema = new XMLReader();
     /**
      * Add a wrapper to make the XML viable and ensure that self closing tags contain a space before the '/>'
      * The XML may still be invalid but that's down to what the user entered
      */
     $node_content = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<da_root>" . $node_content . '</da_root>';
     $xml_schema->XML($node_content);
     // XML file to table map is valid XML - construct the arrays used in file extraction
     $use_read = true;
     // The XML could only be validated against a DTD if the syntax of the XML used for the map is made more complex
     $validate_xml = false;
     if ($validate_xml == true) {
         // Note: When the DTD is external, the property value must be set before the first read()
         $xml_schema->setParserProperty(XMLReader::VALIDATE, true);
     }
     while ($use_read ? $xml_schema->read() : $xml_schema->next()) {
         // Validation checking disabled because a DTD (or RELAX NG) schema is required.
         if ($validate_xml == true) {
             if ($xml_schema->isValid() == false) {
                 $xml_schema->close();
                 return false;
             }
         }
         // Default to a reading a single node in the next loop
         $use_read = true;
         // Ignore any node associated with the root
         if ($xml_schema->name == 'da_root') {
             continue;
         }
         // Process start elements
         if ($xml_schema->nodeType == XMLReader::ELEMENT) {
             $self_closing = $xml_schema->isEmptyElement;
             // Ready to add a new node - but only if the last node was closed
             if (!empty($current_node)) {
                 $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_XML_NODE_UNCLOSED', $current_node));
                 return false;
             }
             // A new node was found - Check whether this is a new record type
             if (empty($current_record)) {
                 // New record type
                 // Check for a self-closing node
                 $self_closing = $xml_schema->isEmptyElement;
                 $current_record = strtolower($xml_schema->name);
                 $this->_xml_records[] = strtolower($current_record);
                 // Store any attributes
                 while ($xml_schema->moveToNextAttribute()) {
                     // Note1: $xml_schema->hasValue only indicates whether the element can have a value, not whether it does
                     // Note2: empty($xml_schema->value) always return true, regardless of the actual value
                     $value = $xml_schema->value;
                     if (!empty($value)) {
                         if ($this->_isXmlFieldNameValid($xml_schema->value)) {
                             $this->_xml_schema[$current_record]['attrs'][strtolower($xml_schema->name)] = trim($xml_schema->value);
                         } else {
                             $csvilog->AddStats('incorrect', JText::sprintf('COM_CSVI_XML_FILE_MAP_NO_REFERENCE', $xml_schema->value));
                             $xml_schema->close();
                             return false;
                         }
                     }
                 }
                 // Check for a self-closing node
                 if ($self_closing == true) {
                     $current_record = '';
                 }
             } else {
                 // New field type
                 $current_node = strtolower($xml_schema->name);
                 $current_path = $this->_getXmlNodePath($xml_path, $current_node);
                 // Store any attributes
                 while ($xml_schema->moveToNextAttribute()) {
                     // Note1: $xml_schema->hasValue only indicates whether the element can have a value, not whether it does
                     // Note2: empty($xml_schema->value) always return true, regardless of the actual value
                     $value = $xml_schema->value;
                     if (!empty($value)) {
                         if ($this->_isXmlFieldNameValid($xml_schema->value)) {
                             $this->_xml_schema[$current_record]['nodes'][$current_path]['attrs'][strtolower($xml_schema->name)] = trim($xml_schema->value);
                         } else {
                             $csvilog->AddStats('incorrect', JText::_('COM_CSVI_XML_FILE_MAP_NO_REFERENCE', $xml_schema->value));
                             $xml_schema->close();
                             return false;
                         }
                     }
                 }
                 $sub_node_content = $xml_schema->readInnerXML();
                 // Check whether there are any lower level nodes
                 if (strstr($sub_node_content, '<') === false) {
                     /**
                      * Content has no embedded nodes - Assume a field name
//.........这里部分代码省略.........
开发者ID:spiridonov-oa,项目名称:SheinCandles,代码行数:101,代码来源:xml.php

示例9: config_xml_data

    /**
     * @access public
     * Chargement des données de configuration dans le fichier XML
     */
    public function config_xml_data()
    {
        $pathxml = $this->pluginDir() . 'config.xml';
        if (file_exists($pathxml)) {
            try {
                $xml = new XMLReader();
                $xml->open($pathxml, "UTF-8");
                // Configuration d'analyse XML
                //$xml->setParserProperty(XMLReader::VALIDATE, true);
                //if($xml->isValid()){
                while ($xml->read()) {
                    if ($xml->nodeType == XMLREADER::ELEMENT && $xml->localName == "infos") {
                        $v = $xml->expand();
                        $v = new SimpleXMLElement('<infos>' . $xml->readInnerXML() . '</infos>', 0, false);
                        //echo ReflectionObject::export($v);
                        //echo ReflectionObject::export($v['attr']);
                        $r = '';
                        if ($v->version) {
                            $r .= '<table class="table table-bordered table-condensed table-hover">
								<tr>
									<td>Création:</td>
									<td>' . $v->version->date_create . '</td>
								</tr>
								<tr>
									<td>Update:</td>
									<td>' . $v->version->date_update . '</td>
								</tr>
								<tr>
									<td>Version:</td>
									<td>' . $v->version->number . ' ' . $v->version->phase . '</td>
								</tr>';
                            if ($v->version->support->forum['href'] != false) {
                                $r .= '<tr>
									<td>Support:</td>
									<td><a class="targetblank" href="' . $v->version->support->forum['href'] . '">' . $v->version->support->forum . '</a></td>
								</tr>';
                            }
                            if ($v->version->support->ticket['href'] != false) {
                                $r .= '<tr>
									<td>Tickets:</td>
									<td><a class="targetblank" href="' . $v->version->support->ticket['href'] . '"><span class="fa fa-bullhorn"></span> Signaler un bug</a></td>
								</tr>';
                            }
                            if ($v->version->support->svn['href'] != false) {
                                $r .= '<tr>
									<td class="small-icon">SVN:</td>
									<td><a class="targetblank" href="' . $v->version->support->svn['href'] . '"><span class="icon fa fa-svn"></span></a></td>
								</tr>';
                            }
                            if ($v->version->support->git['href'] != false) {
                                $r .= '<tr>
									<td>GIT:</td>
									<td><a class="targetblank" href="' . $v->version->support->git['href'] . '"><span class="fa fa-github fa fa-large"></span></a></td>
								</tr>';
                            }
                            $r .= '</table>';
                        }
                        if ($v->authors) {
                            $r .= '<table class="table table-bordered table-condensed table-hover">
								<thead>
									<tr>
										<th>Author</th>
										<th>Website</th>
									</tr>
								</thead>
								<tbody>';
                            foreach ($v->authors->author as $row) {
                                $r .= '<tr>';
                                $r .= '<td>' . $row->name . '</td>';
                                $r .= '<td><ul class="list-unstyled">';
                                $t = '';
                                foreach ($row->link->children() as $link) {
                                    $r .= '<li><a class="targetblank" ';
                                    $r .= 'href="' . $link->attributes()->href . '">' . $link->attributes()->href . '</a></li>';
                                }
                                $r .= '</ul></td>';
                                $r .= '</tr>';
                            }
                            $r .= '</tbody></table>';
                        }
                        return $r;
                    }
                }
                //}
            } catch (Exception $e) {
                magixglobal_model_system::magixlog('An error has occured :', $e);
            }
        }
    }
开发者ID:biggtfish,项目名称:magixcms,代码行数:93,代码来源:plugins.php

示例10: getTransUnitsContent

 /**
  * Gets trans-unit content from the XLIFF file that has been exported for the
  * given job as last.
  */
 protected function getTransUnitsContent(JobInterface $job)
 {
     $messages = $job->getMessages();
     $message = reset($messages);
     $download_url = $message->variables->{'@link'};
     $this->assertFalse((bool) strpos('< a', $download_url));
     $xml_string = file_get_contents($download_url);
     $xml = simplexml_load_string($xml_string);
     // Register the xliff namespace, required for xpath.
     $xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:1.2');
     $reader = new \XMLReader();
     $data = array();
     $i = 0;
     foreach ($xml->xpath('//xliff:trans-unit') as $unit) {
         $reader->XML($unit->source->asXML());
         $reader->read();
         $data[$i]['source'] = $reader->readInnerXML();
         $reader->XML($unit->target->asXML());
         $reader->read();
         $data[$i]['target'] = $reader->readInnerXML();
         $i++;
     }
     return $data;
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:28,代码来源:FileTranslatorTest.php

示例11: processForExport

 /**
  * Helper function to process the source text.
  *
  * @param string $source
  *   Job data array.
  * @param array $key_array
  *   The source item data key.
  *
  * @return string
  */
 protected function processForExport($source, array $key_array)
 {
     $tjiid = $key_array[0];
     $key_string = \Drupal::service('tmgmt.data')->ensureStringKey($key_array);
     // The reason why we use DOMDocument object here and not just XMLReader
     // is the DOMDocument's ability to deal with broken HTML.
     $dom = new \DOMDocument();
     // We need to append the head with encoding so that special characters
     // are read correctly.
     $dom->loadHTML("<html><head><meta http-equiv='Content-type' content='text/html; charset=UTF-8' /></head><body>" . $source . '</body></html>');
     $iterator = new \RecursiveIteratorIterator(new RecursiveDOMIterator($dom), \RecursiveIteratorIterator::SELF_FIRST);
     $writer = new \XMLWriter();
     $writer->openMemory();
     $writer->startDocument('1.0', 'UTF-8');
     $writer->startElement('wrapper');
     $tray = array();
     $non_pair_tags = array('br', 'img');
     $xliff_validation = $this->job->getSetting('xliff_validation');
     /** @var \DOMElement $node */
     foreach ($iterator as $node) {
         if (in_array($node->nodeName, array('html', 'body', 'head', 'meta'))) {
             continue;
         }
         if ($node->nodeType === XML_ELEMENT_NODE) {
             // Increment the elements count and compose element id.
             if (!isset($xliff_validation[$key_string])) {
                 $xliff_validation[$key_string] = 0;
             }
             $xliff_validation[$key_string]++;
             $id = 'tjiid' . $tjiid . '-' . $xliff_validation[$key_string];
             $is_pair_tag = !in_array($node->nodeName, $non_pair_tags);
             if ($is_pair_tag) {
                 $this->writeBPT($writer, $node, $id);
             } elseif ($node->nodeName == 'img') {
                 $this->writeIMG($writer, $node, $id);
             } elseif ($node->nodeName == 'br') {
                 $this->writeBR($writer, $node, $id);
             }
             // Add to tray new element info.
             $tray[$id] = array('name' => $node->nodeName, 'id' => $id, 'value' => $node->nodeValue, 'built_text' => '', 'is_pair_tag' => $is_pair_tag);
         } elseif ($node->nodeName == '#text') {
             // Add the node value to the text output.
             $writer->writeCdata($this->toEntities($node->nodeValue));
             foreach ($tray as &$info) {
                 $info['built_text'] .= $node->nodeValue;
             }
         }
         // Reverse so that pair tags are closed in the expected order.
         $reversed_tray = array_reverse($tray);
         foreach ($reversed_tray as $_info) {
             // If the build_text equals to the node value and it is not a pair tag
             // add the end pair tag markup.
             if ($_info['value'] == $_info['built_text'] && $_info['is_pair_tag']) {
                 // Count also for the closing elements.
                 $xliff_validation[$key_string]++;
                 $this->writeEPT($writer, $_info['name'], $_info['id']);
                 // When the end pair tag has been written unset the element info
                 // from the tray.
                 unset($tray[$_info['id']]);
             }
         }
     }
     // Set the xliff_validation data and save the job.
     $this->job->settings->xliff_validation = $xliff_validation;
     $this->job->save();
     $writer->endElement();
     // Load the output with XMLReader so that we can easily get the inner xml.
     $reader = new \XMLReader();
     $reader->XML($writer->outputMemory());
     $reader->read();
     return $reader->readInnerXML();
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:82,代码来源:Xliff.php

示例12: export

 public function export($v92ec19ffde05e15769b1bb3ee05ad745)
 {
     set_time_limit(0);
     if (!count($v92ec19ffde05e15769b1bb3ee05ad745)) {
         $v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
         $v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page(0)->childs(0);
         $v92ec19ffde05e15769b1bb3ee05ad745 = $v8be74552df93e31bbdd6b36ed74bdb6a->result;
     }
     $v857a5246dff0c3c79e476b004684f6d3 = CURRENT_WORKING_DIR . "/sys-temp/export/";
     $vb80bb7740288fda1f201890375a60c8f = getRequest('param0');
     $v97fd815a3803a0588876bdd862014fed = $v857a5246dff0c3c79e476b004684f6d3 . $vb80bb7740288fda1f201890375a60c8f . "." . parent::getFileExt();
     if (getRequest('as_file') === '0') {
         $ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($this->getSourceName());
         $ved780287e302ec3b9fd3c5e78771919f->addBranches($v92ec19ffde05e15769b1bb3ee05ad745);
         $result = $ved780287e302ec3b9fd3c5e78771919f->execute();
         return $result->saveXML();
     }
     if (file_exists($v97fd815a3803a0588876bdd862014fed) && !file_exists(CURRENT_WORKING_DIR . '/sys-temp/runtime-cache/' . md5($this->getSourceName()))) {
         unlink($v97fd815a3803a0588876bdd862014fed);
     }
     $v71b70dd1e455c477220693d84ccd5682 = $v97fd815a3803a0588876bdd862014fed . '.tmp';
     $v480d1b61a0432d1319f7504a3d7318dd = (int) mainConfiguration::getInstance()->get("modules", "exchange.export.limit");
     if ($v480d1b61a0432d1319f7504a3d7318dd <= 0) {
         $v480d1b61a0432d1319f7504a3d7318dd = 25;
     }
     $ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($this->getSourceName(), $v480d1b61a0432d1319f7504a3d7318dd);
     $ved780287e302ec3b9fd3c5e78771919f->addBranches($v92ec19ffde05e15769b1bb3ee05ad745);
     $vdd988cfd769c9f7fbd795a0f5da8e751 = $ved780287e302ec3b9fd3c5e78771919f->execute();
     if (file_exists($v97fd815a3803a0588876bdd862014fed)) {
         $v1de9b0a30075ae8c303eb420c103c320 = new XMLReader();
         $va82feee3cc1af8bcabda979e8775ef0f = new XMLWriter();
         $v1de9b0a30075ae8c303eb420c103c320->open($v97fd815a3803a0588876bdd862014fed);
         $va82feee3cc1af8bcabda979e8775ef0f->openURI($v71b70dd1e455c477220693d84ccd5682);
         $va82feee3cc1af8bcabda979e8775ef0f->startDocument('1.0', 'utf-8');
         $va82feee3cc1af8bcabda979e8775ef0f->startElement('umidump');
         $va82feee3cc1af8bcabda979e8775ef0f->writeAttribute('version', '2.0');
         $va82feee3cc1af8bcabda979e8775ef0f->writeAttribute('xmlns:xlink', 'http://www.w3.org/TR/xlink');
         $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->read();
         while ($v7aa28ed115707345d0274032757e8991) {
             if ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::ELEMENT) {
                 $ve24455211a964330063a18670d943835 = $v1de9b0a30075ae8c303eb420c103c320->name;
                 if ($ve24455211a964330063a18670d943835 != 'umidump') {
                     $va82feee3cc1af8bcabda979e8775ef0f->startElement($ve24455211a964330063a18670d943835);
                     if ($ve24455211a964330063a18670d943835 != 'meta') {
                         if (!$v1de9b0a30075ae8c303eb420c103c320->isEmptyElement) {
                             $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->read();
                             while ($v7852ddca47412c0d947ebf27eb83ed3a) {
                                 if ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::ELEMENT) {
                                     $vcf7f5c76225a101e6320a96c02f92fc1 = $v1de9b0a30075ae8c303eb420c103c320->name;
                                     $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($v1de9b0a30075ae8c303eb420c103c320->readOuterXML());
                                     $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->next();
                                 } elseif ($v1de9b0a30075ae8c303eb420c103c320->nodeType == XMLReader::END_ELEMENT && $v1de9b0a30075ae8c303eb420c103c320->name == $ve24455211a964330063a18670d943835) {
                                     $v7852ddca47412c0d947ebf27eb83ed3a = false;
                                 } else {
                                     $v7852ddca47412c0d947ebf27eb83ed3a = $v1de9b0a30075ae8c303eb420c103c320->next();
                                 }
                             }
                         }
                         if ($vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName($ve24455211a964330063a18670d943835)->item(0)->hasChildNodes()) {
                             $v268184c12df027f536154d099d497b31 = $vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName($ve24455211a964330063a18670d943835)->item(0)->childNodes;
                             foreach ($v268184c12df027f536154d099d497b31 as $v1b7d5726533ab525a8760351e9b5e415) {
                                 $va5e171f642af8e3bd24c50cdc4d66fe3 = new DOMDocument();
                                 $va5e171f642af8e3bd24c50cdc4d66fe3->formatOutput = true;
                                 $v36c4536996ca5615dcf9911f068786dc = $va5e171f642af8e3bd24c50cdc4d66fe3->importNode($v1b7d5726533ab525a8760351e9b5e415, true);
                                 $va5e171f642af8e3bd24c50cdc4d66fe3->appendChild($v36c4536996ca5615dcf9911f068786dc);
                                 $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($va5e171f642af8e3bd24c50cdc4d66fe3->saveXML($v36c4536996ca5615dcf9911f068786dc, LIBXML_NOXMLDECL));
                             }
                         }
                     } elseif ($ve24455211a964330063a18670d943835 == 'meta') {
                         $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($v1de9b0a30075ae8c303eb420c103c320->readInnerXML());
                         $v92ec19ffde05e15769b1bb3ee05ad745 = $vdd988cfd769c9f7fbd795a0f5da8e751->getElementsByTagName('branches');
                         if ($v92ec19ffde05e15769b1bb3ee05ad745->item(0)) {
                             $va82feee3cc1af8bcabda979e8775ef0f->writeRaw($vdd988cfd769c9f7fbd795a0f5da8e751->saveXML($v92ec19ffde05e15769b1bb3ee05ad745->item(0), LIBXML_NOXMLDECL));
                         }
                     }
                     $va82feee3cc1af8bcabda979e8775ef0f->fullEndElement();
                     $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->next();
                     continue;
                 }
             }
             $v7aa28ed115707345d0274032757e8991 = $v1de9b0a30075ae8c303eb420c103c320->read();
         }
         $va82feee3cc1af8bcabda979e8775ef0f->fullEndElement();
         $v1de9b0a30075ae8c303eb420c103c320->close();
         $va82feee3cc1af8bcabda979e8775ef0f->endDocument();
         $va82feee3cc1af8bcabda979e8775ef0f->flush();
         unlink($v97fd815a3803a0588876bdd862014fed);
         rename($v71b70dd1e455c477220693d84ccd5682, $v97fd815a3803a0588876bdd862014fed);
     } else {
         file_put_contents($v97fd815a3803a0588876bdd862014fed, $vdd988cfd769c9f7fbd795a0f5da8e751->saveXML());
     }
     $this->completed = $ved780287e302ec3b9fd3c5e78771919f->isCompleted();
     return false;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:94,代码来源:umiDump20Exporter.php

示例13: getFeature

 /**
  * Gets the request result, converts it from XML to DOS and returns it.
  * gets Whitelist words from the layer and finds tags into the XML file.
  *
  * @param Int $featureID Station (feature) ID
  * @param String $extraParams, extra param for the request (normally coming from JS)
  *
  * @return DataObjectSet $obj, set of results
  **/
 function getFeature($featureID, $extraParams = '')
 {
     $namespace = 'ms';
     if (!$featureID) {
         throw new OLLayer_Exception('Wrong params');
     }
     $currentFeatureID = '';
     $params = array('featureID' => $featureID, 'ExtraParams' => $extraParams);
     $output = $this->getFeatureInfo($params);
     $obj = new ArrayList();
     $reader = new XMLReader();
     $reader->XML($output);
     // loop xml for attributes
     $attributes = array();
     while ($reader->read()) {
         if ($reader->nodeType != XMLReader::END_ELEMENT && $reader->readInnerXML() != "") {
             // skip ms:msFeatureCollection
             if ($reader->name != $namespace . ":msFeatureCollection") {
                 // strip ms: namespace from xml response
                 if (substr_compare($reader->name, $namespace . ":", 0, 3) === 0) {
                     $name = substr_replace($reader->name, '', 0, 3);
                     if ($name != $this->ogc_name) {
                         $attributes[$name] = $reader->readInnerXML();
                     } else {
                         // found a new ID tag which is at the beginning of
                         // an new feature item.
                         if (!empty($attributes)) {
                             $attributes['FeatureID'] = $currentFeatureID;
                             $obj->push(new ArrayData($attributes));
                         }
                         $currentFeatureID = $reader->getAttribute('gml:id');
                         $attributes = array();
                     }
                 }
             }
         }
     }
     if (!empty($attributes)) {
         $attributes['FeatureID'] = $currentFeatureID;
         $obj->push(new ArrayData($attributes));
     }
     $reader->close();
     return $obj;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-openlayers,代码行数:53,代码来源:OLLayer.php

示例14: XMLReader

<?php

$z = new XMLReader();
$getXml = file_get_contents('http://www.cs.washington.edu/research/xmldatasets/data/courses/uwm.xml');
$z->xml($getXml);
$levels = array();
while ($z->read()) {
    if ($z->name === 'level') {
        $lvl = $z->readInnerXML();
        $levels[$lvl]++;
    }
}
var_dump($levels);
开发者ID:marekdan,项目名称:coders_lab,代码行数:13,代码来源:index.php


注:本文中的XMLReader::readInnerXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。