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


PHP XMLWriter::writeAttributeNs方法代码示例

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


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

示例1: writeRequest

 /**
  * Write the service document in Atom format.
  * 
  * @param Object &$dummy Dummy object
  * 
  * @return string
  */
 public function writeRequest(&$dummy)
 {
     $this->_xmlWriter = new \XMLWriter();
     $this->_xmlWriter->openMemory();
     $this->_xmlWriter->startElementNs(null, ODataConstants::ATOM_PUBLISHING_SERVICE_ELEMENT_NAME, ODataConstants::APP_NAMESPACE);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XML_NAMESPACE_PREFIX, ODataConstants::XML_BASE_ATTRIBUTE_NAME, null, $this->_baseUri);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, self::ATOM_NAMESPACE_PREFIX, null, ODataConstants::ATOM_NAMESPACE);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, self::APP_NAMESPACE_PREFIX, null, ODataConstants::APP_NAMESPACE);
     $this->_xmlWriter->startElement(ODataConstants::ATOM_PUBLISHING_WORKSPACE_ELEMNT_NAME);
     $this->_xmlWriter->startElementNs(self::ATOM_NAMESPACE_PREFIX, ODataConstants::ATOM_TITLE_ELELMET_NAME, null);
     $this->_xmlWriter->text(ODataConstants::ATOM_PUBLISHING_WORKSPACE_DEFAULT_VALUE);
     $this->_xmlWriter->endElement();
     foreach ($this->_metadataQueryproviderWrapper->getResourceSets() as $resourceSetWrapper) {
         //start collection node
         $this->_xmlWriter->startElement(ODataConstants::ATOM_PUBLISHING_COLLECTION_ELEMENT_NAME);
         $this->_xmlWriter->writeAttribute(ODataConstants::ATOM_HREF_ATTRIBUTE_NAME, $resourceSetWrapper->getName());
         //start title node
         $this->_xmlWriter->startElementNs(self::ATOM_NAMESPACE_PREFIX, ODataConstants::ATOM_TITLE_ELELMET_NAME, null);
         $this->_xmlWriter->text($resourceSetWrapper->getName());
         //end title node
         $this->_xmlWriter->endElement();
         //end collection node
         $this->_xmlWriter->endElement();
     }
     //End workspace and service nodes
     $this->_xmlWriter->endElement();
     $this->_xmlWriter->endElement();
     $serviceDocumentInAtom = $this->_xmlWriter->outputMemory(true);
     return $serviceDocumentInAtom;
 }
开发者ID:i-geo,项目名称:odataphpprod,代码行数:37,代码来源:ServiceDocumentWriter.php

示例2: writeBaseUriAndDefaultNamespaces

 /**
  * Function to write base uri and default namespaces for top level elements.
  * 
  * @return nothing
  */
 public function writeBaseUriAndDefaultNamespaces()
 {
     $this->xmlWriter->writeAttribute(ODataConstants::XML_BASE_ATTRIBUTE_NAME_WITH_PREFIX, $this->baseUri);
     $this->xmlWriter->writeAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, ODataConstants::ODATA_NAMESPACE_PREFIX, null, ODataConstants::ODATA_NAMESPACE);
     $this->xmlWriter->writeAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, ODataConstants::ODATA_METADATA_NAMESPACE_PREFIX, null, ODataConstants::ODATA_METADATA_NAMESPACE);
     $this->xmlWriter->writeAttribute(ODataConstants::XMLNS_NAMESPACE_PREFIX, ODataConstants::ATOM_NAMESPACE);
 }
开发者ID:maxromanov,项目名称:odataphpprod,代码行数:12,代码来源:AtomODataWriter.php

示例3: toString

 /**
  * {@inheritdoc}
  */
 public function toString(Workout $workout) : string
 {
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $xmlWriter->setIndent(true);
     $xmlWriter->startDocument('1.0', 'UTF-8');
     $xmlWriter->startElement('gpx');
     $xmlWriter->writeAttribute('version', '1.1');
     $xmlWriter->writeAttribute('creator', 'SportTrackerConnector');
     $xmlWriter->writeAttributeNs('xsi', 'schemaLocation', null, 'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd');
     $xmlWriter->writeAttribute('xmlns', 'http://www.topografix.com/GPX/1/1');
     $xmlWriter->writeAttributeNs('xmlns', 'gpxtpx', null, 'http://www.garmin.com/xmlschemas/TrackPointExtension/v1');
     $xmlWriter->writeAttributeNs('xmlns', 'gpxx', null, 'http://www.garmin.com/xmlschemas/GpxExtensions/v3');
     $xmlWriter->writeAttributeNs('xmlns', 'xsi', null, 'http://www.w3.org/2001/XMLSchema-instance');
     $this->writeMetaData($xmlWriter, $workout);
     $this->writeTracks($xmlWriter, $workout);
     $xmlWriter->endElement();
     $xmlWriter->endDocument();
     return $xmlWriter->outputMemory(true);
 }
开发者ID:dragosprotung,项目名称:stc-core,代码行数:23,代码来源:GPX.php

示例4: handleNamespace

 /**
  * Method for working with namespaces
  *
  * @param array $ns - namespace definition
  *
  * @return void
  *
  * @since 1.0
  */
 protected function handleNamespace($ns)
 {
     $name = $prefix = null;
     if ($name = $this->getOrNull($ns, 'name')) {
         $temp = explode(':', $name);
         if (count($temp) === 2) {
             list($name, $prefix) = $temp;
         } else {
             $name = current($temp);
         }
     }
     $this->writer->writeAttributeNs($name, $prefix, $this->getOrNull($ns, 'uri'), $this->getOrNull($ns, 'content'));
 }
开发者ID:realshadow,项目名称:serializers,代码行数:22,代码来源:Xml.php

示例5: _writeEntityContainer

 /**
  * Write entity container 
  * 
  * @return nothing
  */
 private function _writeEntityContainer()
 {
     $this->_iOdataWriter->startElement(ODataConstants::ENTITY_CONTAINER);
     $this->_iOdataWriter->writeAttribute(ODataConstants::NAME, $this->_metadataQueryproviderWrapper->getContainerName());
     $this->_iOdataWriter->writeAttributeNs(ODataConstants::ODATA_METADATA_NAMESPACE_PREFIX, ODataConstants::ISDEFAULT_ENTITY_CONTAINER_ATTRIBUTE, null, "true");
     foreach ($this->_metadataManager->getResourceSets() as $resourceSet) {
         $this->_iOdataWriter->startElement(ODataConstants::ENTITY_SET);
         $this->_iOdataWriter->writeAttribute(ODataConstants::NAME, $resourceSet->getName());
         $this->_iOdataWriter->writeAttribute(ODataConstants::ENTITY_TYPE, $resourceSet->getResourceType()->getFullName());
         $this->_iOdataWriter->endElement();
     }
     $this->_writeAssociationSets();
     $this->_iOdataWriter->endElement();
 }
开发者ID:maxromanov,项目名称:odataphpprod,代码行数:19,代码来源:MetadataWriter.php

示例6: toXml

 /**
  * Writes this ChildAndParentsRelationship to an XML writer.
  *
  * @param \XMLWriter $writer The XML writer.
  * @param bool $includeNamespaces Whether to write out the namespaces in the element.
  */
 public function toXml(\XMLWriter $writer, $includeNamespaces = true)
 {
     $writer->startElementNS('fs', 'childAndParentsRelationship', null);
     if ($includeNamespaces) {
         $writer->writeAttributeNs('xmlns', 'gx', null, 'http://gedcomx.org/v1/');
         $writer->writeAttributeNs('xmlns', 'fs', null, 'http://familysearch.org/v1/');
     }
     $this->writeXmlContents($writer);
     $writer->endElement();
 }
开发者ID:BRGWeb,项目名称:gedcomx-php,代码行数:16,代码来源:ChildAndParentsRelationship.php

示例7: toXml

 /**
  * Writes this SourceDescription to an XML writer.
  *
  * @param \XMLWriter $writer The XML writer.
  * @param bool $includeNamespaces Whether to write out the namespaces in the element.
  */
 public function toXml(\XMLWriter $writer, $includeNamespaces = true)
 {
     $writer->startElementNS('gx', 'sourceDescription', null);
     if ($includeNamespaces) {
         $writer->writeAttributeNs('xmlns', 'gx', null, 'http://gedcomx.org/v1/');
     }
     $this->writeXmlContents($writer);
     $writer->endElement();
 }
开发者ID:BRGWeb,项目名称:gedcomx-php,代码行数:15,代码来源:SourceDescription.php

示例8: toXml

 /**
  * Writes this Entry to an XML writer.
  *
  * @param \XMLWriter $writer            The XML writer.
  * @param bool       $includeNamespaces Whether to write out the namespaces in the element.
  */
 public function toXml($writer, $includeNamespaces = true)
 {
     $writer->startElementNS('atom', 'entry', null);
     if ($includeNamespaces) {
         $writer->writeAttributeNs('xmlns', 'gx', null, 'http://gedcomx.org/v1/');
         $writer->writeAttributeNs('xmlns', 'atom', null, 'http://www.w3.org/2005/Atom');
     }
     $this->writeXmlContents($writer);
     $writer->endElement();
 }
开发者ID:BRGWeb,项目名称:gedcomx-php,代码行数:16,代码来源:Entry.php

示例9: toXml

 /**
  * Writes this HealthConfig to an XML writer.
  *
  * @param \XMLWriter $writer The XML writer.
  * @param bool $includeNamespaces Whether to write out the namespaces in the element.
  */
 public function toXml($writer, $includeNamespaces = true)
 {
     $writer->startElementNS('fs', 'healthConfig', null);
     if ($includeNamespaces) {
         $writer->writeAttributeNs('xmlns', 'fs', null, 'http://familysearch.org/v1/');
     }
     $this->writeXmlContents($writer);
     $writer->endElement();
 }
开发者ID:BRGWeb,项目名称:gedcomx-php,代码行数:15,代码来源:HealthConfig.php

示例10: generateWSDL

function generateWSDL($array)
{
    if (is_array($array)) {
        $a = new ArrayObject();
        // Création d'un tableau d'objet
        foreach ($array as $r) {
            $bdd = new PDO('mysql:host=localhost;dbname=new_schema;charset=utf8', 'root', 'admin', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
            $result = $bdd->query("SELECT DISTINCT function_name,variable_name,variable_input,type_namewsdl,server_name " . "FROM access,client,function,variable,type,server " . "WHERE client.client_id=access.client_id " . "AND function.function_id=access.function_id " . "AND function.server_id=server.server_id " . "AND function.function_id={$r} " . "AND function.function_id=variable.function_id " . "AND variable.type_id=type.type_id ");
            while ($row = $result->fetch()) {
                //On définit une nouvelle instance de la classe resultat
                $ligne = new resultat($row);
                // On fait un appel à la methode "population" qui stocke la ligne de resultat de la requête
                $ligne->population($row);
                // On stocke l'objet dans un tableau d'objet.
                $a->append($ligne);
            }
            $bdd = null;
        }
    }
    /*
     *  definition des variables utiles pour écrire le WSDL  
     */
    $tempRequest = "";
    // variable utile pour la création du fichier WSDL
    $tempResponse = "";
    // variable utile pour la création du fichier WSDL
    $tempServer = "";
    // On va stocker plus tard le nom de serveur dans cette variable
    $tempFunction = "";
    $parcours = 0;
    /*
     * on commence l'écriture du WSDL au format XML
     */
    header('Content-type: text/xml; charset=UTF-8');
    $oXMLWriter = new XMLWriter();
    $oXMLWriter->openMemory();
    $oXMLWriter->startDocument('1.0', 'UTF-8');
    $oXMLWriter->setIndent(true);
    foreach ($a as $q) {
        if (strcmp($q->server_name, $tempServer) != 0) {
            /*
             * écriture de la balise d'ouverture "definition"
             */
            $oXMLWriter->startElementNS('wsdl', 'definition', 'http://schemas.xmlsoap.org/wsdl/');
            $oXMLWriter->writeAttribute('name', $q->server_name);
            $oXMLWriter->writeAttributeNs('xmlns', 'soap', NULL, 'http://schemas.xmlsoap.org/wsdl/soap/');
            $oXMLWriter->writeAttributeNs('xmlns', 'xsd', NULL, 'http://www.w3.org/2001/XMLSchema');
            $oXMLWriter->writeAttributeNs('xmlns', 'soapenc', NULL, 'http://schemas.xmlsoap.org/soap/encoding/');
            $oXMLWriter->writeAttribute('xmlns', 'http://schemas.xmlsoap.org/wsdl/');
            //on utilise une boucle foreach pour parcourir l'ensemble des résultats
            foreach ($a as $r) {
                //ecriture de la premiere balise request
                // Dans la boucle if, si lors d'une nouvelle itération la fonction est toujours la meme on ne rentre pas dedans.
                if ($r->variable_input == 1 && strcmp($r->function_name, $tempRequest) != 0) {
                    $oXMLWriter->startElementNS('wsdl', 'message', NULL);
                    $oXMLWriter->writeAttribute('name', 'get' . $r->function_name . 'Request');
                    foreach ($a as $s) {
                        if (strcmp($s->function_name, $r->function_name) == 0 && $s->variable_input == 1) {
                            $oXMLWriter->startElementNS('wsdl', 'part', NULL);
                            $oXMLWriter->writeAttribute('name', $s->variable_name);
                            $oXMLWriter->writeAttribute('type', $s->type_namewsdl);
                            $oXMLWriter->endElement();
                        }
                    }
                    $oXMLWriter->endElement();
                }
                $tempRequest = $r->function_name;
                if ($r->variable_input == 0) {
                    //&& (strcmp($r->function_name,$tempResponse))!=0){
                    $oXMLWriter->startElementNS('wsdl', 'message', NULL);
                    $oXMLWriter->writeAttribute('name', 'get' . $r->function_name . 'Response');
                    foreach ($a as $s) {
                        if (strcmp($s->function_name, $r->function_name) == 0 && $s->variable_input == 0) {
                            $oXMLWriter->startElementNS('wsdl', 'part', NULL);
                            $oXMLWriter->writeAttribute('name', $s->variable_name);
                            $oXMLWriter->writeAttribute('type', $s->type_namewsdl);
                            $oXMLWriter->endElement();
                        }
                    }
                    $oXMLWriter->endElement();
                }
                $tempResponse = $r->function_name;
            }
            foreach ($a as $r) {
                if (strcmp($r->function_name, $tempFunction) != 0) {
                    $oXMLWriter->startElementNS('wsdl', 'portType', NULL);
                    $oXMLWriter->writeAttribute('name', $r->function_name . 'PortType');
                    $oXMLWriter->startElementNS('wsdl', 'operation', NULL);
                    $oXMLWriter->writeAttribute('name', 'get' . $r->function_name);
                    foreach ($a as $s) {
                        if (strcmp($s->function_name, $r->function_name) == 0 && $s->variable_input == 1 && $parcours == 0) {
                            $oXMLWriter->startElementNS('wsdl', 'input', NULL);
                            $oXMLWriter->writeAttribute('message', 'tns:get' . $r->function_name . 'Request');
                            $oXMLWriter->endElement();
                            $parcours = 1;
                        }
                        if (strcmp($s->function_name, $r->function_name) == 0 && $s->variable_input == 0) {
                            $oXMLWriter->startElementNS('wsdl', 'output', NULL);
                            $oXMLWriter->writeAttribute('message', 'tns:get' . $r->function_name . 'Response');
                            $oXMLWriter->endElement();
//.........这里部分代码省略.........
开发者ID:Acedrin,项目名称:PGROU,代码行数:101,代码来源:generateWSDL.php

示例11: writeLapHeartRateDate

 /**
  * Write the heart rate data for a lap.
  *
  * @param \XMLWriter $xmlWriter The XML writer.
  * @param Track $track The track to write.
  */
 protected function writeLapHeartRateDate(\XMLWriter $xmlWriter, Track $track)
 {
     $averageHeartRate = array();
     $maxHearRate = null;
     foreach ($track->trackPoints() as $trackPoint) {
         if ($trackPoint->hasExtension(HR::ID()) === true) {
             $pointHearRate = $trackPoint->extension(HR::ID())->value();
             $maxHearRate = max($maxHearRate, $pointHearRate);
             $averageHeartRate[] = $pointHearRate;
         }
     }
     if ($averageHeartRate !== array()) {
         $xmlWriter->startElement('AverageHeartRateBpm');
         $xmlWriter->writeAttributeNs('xsi', 'type', null, 'HeartRateInBeatsPerMinute_t');
         $hearRateValue = array_sum($averageHeartRate) / count($averageHeartRate);
         $xmlWriter->writeElement('Value', (string) $hearRateValue);
         $xmlWriter->endElement();
     }
     if ($maxHearRate !== null) {
         $xmlWriter->startElement('MaximumHeartRateBpm');
         $xmlWriter->writeAttributeNs('xsi', 'type', null, 'HeartRateInBeatsPerMinute_t');
         $xmlWriter->writeElement('Value', (string) $maxHearRate);
         $xmlWriter->endElement();
     }
 }
开发者ID:dragosprotung,项目名称:stc-core,代码行数:31,代码来源:TCX.php

示例12: toXml

 /**
  * Writes this Note to an XML writer.
  *
  * @param \XMLWriter $writer            The XML writer.
  * @param bool       $includeNamespaces Whether to write out the namespaces in the element.
  */
 public function toXml(\XMLWriter $writer, $includeNamespaces = true)
 {
     $writer->startElementNS('gx', 'note', null);
     if ($includeNamespaces) {
         $writer->writeAttributeNs('xmlns', 'gx', null, 'http://gedcomx.org/v1/');
         $writer->writeAttributeNs('xmlns', 'xml', null, 'http://www.w3.org/XML/1998/namespace');
     }
     $this->writeXmlContents($writer);
     $writer->endElement();
 }
开发者ID:BRGWeb,项目名称:gedcomx-php,代码行数:16,代码来源:Note.php

示例13: XmlOutputModel

$Dates = Date::GetDates();
$Tag2Alls = Tag2All::GetTag2Alls();
$outfile = 'CandyDollDB.xml';
if ($ModelID && count($Models) > 0) {
    $Model = $Models[0];
    $outfile = sprintf('CandyDollDB %1$s%2$s%3$s.xml', $Model->GetFullName(), $IncludeImages && $IncludeVideos ? ' ' . $lang->g('LabelComplete') : ($IncludeImages ? ' ' . $lang->g('NavigationImages') : ($IncludeVideos ? ' ' . $lang->g('NavigationVideos') : NULL)), ($IncludeImages || $IncludeVideos) && $TaggedOnly ? ' ' . $lang->g('LabelTagged') : NULL);
}
header(sprintf('Content-Type: %1$s', Utils::GetMime('xml')));
header(sprintf('Content-Disposition: attachment; filename="%1$s"', $outfile));
$xmlw = new XMLWriter();
$xmlw->openUri('php://output');
$xmlw->setIndent(TRUE);
$xmlw->setIndentString("\t");
$xmlw->startDocument('1.0', 'UTF-8');
$xmlw->startElement('Models');
$xmlw->writeAttributeNs('xmlns', 'xsi', NULL, 'http://www.w3.org/2001/XMLSchema-instance');
$xmlw->writeAttributeNs('xsi', 'noNamespaceSchemaLocation', NULL, 'candydolldb.xsd');
$xmlw->writeAttribute('xmlns', NULL);
function XmlOutputModel($Model, $TaggedOnly)
{
    global $xmlw, $Sets, $Dates, $Tag2Alls, $IncludeImages, $IncludeVideos;
    $xmlw->startElement('Model');
    $xmlw->writeAttribute('firstname', $Model->getFirstName());
    $xmlw->writeAttribute('lastname', $Model->getLastName());
    $xmlw->writeAttribute('birthdate', $Model->getBirthdate() > 0 ? date('Y-m-d', $Model->getBirthdate()) : NULL);
    $TagsThisModel = Tag2All::Filter($Tag2Alls, NULL, $Model->getID(), FALSE, FALSE, FALSE);
    $TagsThisModelOnly = Tag2All::Filter($TagsThisModel, NULL, $Model->getID(), NULL, NULL, NULL);
    $xmlw->writeAttribute('tags', Tag2All::Tags2AllCSV($TagsThisModelOnly));
    $SetsThisModel = Set::Filter($Sets, $Model->getID());
    if ($SetsThisModel) {
        $xmlw->startElement('Sets');
开发者ID:laiello,项目名称:candydolldb,代码行数:31,代码来源:download_xml.php


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