本文整理汇总了PHP中XMLWriter::startElementNs方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::startElementNs方法的具体用法?PHP XMLWriter::startElementNs怎么用?PHP XMLWriter::startElementNs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLWriter
的用法示例。
在下文中一共展示了XMLWriter::startElementNs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(DOMElement $context, $line)
{
$this->contextNode = $context;
$this->writer = new XMLWriter();
$this->writer->openMemory();
$this->writer->startElementNs(null, $context->nodeName, 'http://schema.phpunit.de/coverage/1.0');
$this->writer->writeAttribute('nr', $line);
}
示例2: addNotEmpty
public function addNotEmpty($node, \XMLWriter &$writer)
{
if (isset($node[$this->xsd_generator->getFullName('not_empty')]) && $node[$this->xsd_generator->getFullName('not_empty')]) {
$writer->startElementNs('xsd', 'simpleType', null);
$writer->startElementNs('xsd', 'restriction', null);
$writer->writeAttribute('base', 'xsd:decimal');
$writer->startElementNs('xsd', 'pattern', null);
$writer->writeAttribute('value', '^[^0]*$');
$writer->endElement();
$writer->endElement();
$writer->endElement();
return true;
}
return false;
}
示例3: 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;
}
示例4: addIgnoreExtraKeys
public function addIgnoreExtraKeys($node, \XMLWriter &$writer)
{
if (isset($node[$this->xsd_generator->getFullName('ignore_extra_keys')]) && $node[$this->xsd_generator->getFullName('ignore_extra_keys')]) {
// not_empty makes sense only here - so let's test it
$min = isset($node[$this->xsd_generator->getFullName('not_empty')]) && $node[$this->xsd_generator->getFullName('not_empty')] ? '1' : '0';
$writer->startElementNs('xsd', 'sequence', null);
$writer->startElementNs('xsd', 'any', null);
$writer->writeAttribute('processContents', 'skip');
$writer->writeAttribute('minOccurs', $min);
$writer->writeAttribute('maxOccurs', 'unbounded');
$writer->endElement();
$writer->endElement();
return true;
}
return false;
}
示例5: build
public function build($name, $node, \XMLWriter &$writer, $under_root)
{
// always inside an xsd:element
$writer->startElementNs('xsd', 'element', null);
$writer->writeAttribute('name', $name);
$this->addRequired($node, $writer, $under_root);
$writer->writeAttribute('type', 'xsd:boolean');
$writer->endElement();
}
示例6: buildRootNode
public function buildRootNode($type, $node, \XMLWriter &$writer)
{
if ($type !== 'array') {
throw new \Exception('Only array root nodes are supported');
}
$writer->startElementNs('xsd', 'schema', 'http://www.w3.org/2001/XMLSchema');
foreach ($node[$this->getFullName('children')] as $key => $value) {
$this->buildNode($key, $value[$this->getFullName('type')], $value, $writer, true);
}
$writer->endElement();
}
示例7: _writeNamedStreams
/**
* Write all named streams in the given entity type
*
* @param ResourceType $resourceType resource type
*
* @return nothing
*/
private function _writeNamedStreams(ResourceType $resourceType)
{
$namedStreams = $resourceType->getNamedStreamsDeclaredOnThisType();
if (!empty($namedStreams)) {
$this->_iOdataWriter->startElementNs(null, ODataConstants::DATAWEB_NAMEDSTREAMS_ELEMENT, ODataConstants::ODATA_METADATA_NAMESPACE);
foreach ($namedStreams as $namedStreamName => $resourceStreamInfo) {
$this->_iOdataWriter->startElementNs(null, ODataConstants::DATAWEB_NAMEDSTREAM_ELEMENT, ODataConstants::ODATA_METADATA_NAMESPACE);
$this->_iOdataWriter->writeAttribute(ODataConstants::NAME, $resourceStreamInfo->getName());
$this->_iOdataWriter->endElement();
}
$this->_iOdataWriter->endElement();
}
}
示例8: beginBagPropertyItem
/**
* Begin an item in a collection
*
* @param ODataProperty &$odataBagProperty Bag property object
* to begin write property
*
* @return nothing
*/
protected function beginBagPropertyItem(ODataProperty &$odataBagProperty)
{
foreach ($odataBagProperty->value->propertyContents as $odataPropertyContent) {
if ($odataPropertyContent instanceof ODataPropertyContent) {
$this->xmlWriter->startElementNs(ODataConstants::ODATA_NAMESPACE_PREFIX, ODataConstants::COLLECTION_ELEMENT_NAME, null);
$this->writeBeginProperties($odataPropertyContent);
$this->xmlWriter->endElement();
} else {
$this->xmlWriter->startElementNs(ODataConstants::ODATA_NAMESPACE_PREFIX, ODataConstants::COLLECTION_ELEMENT_NAME, null);
$this->xmlWriter->text($odataPropertyContent);
$this->xmlWriter->endElement();
}
}
}
示例9: writeBagContent
/**
* Begin an item in a collection
*
* @param ODataBagContent $bag Bag property object to begin write property
*
*
* @return AtomODataWriter
*/
protected function writeBagContent(ODataBagContent $bag)
{
foreach ($bag->propertyContents as $content) {
if ($content instanceof ODataPropertyContent) {
$this->xmlWriter->startElementNs(ODataConstants::ODATA_NAMESPACE_PREFIX, ODataConstants::COLLECTION_ELEMENT_NAME, null);
$this->writeProperties($content);
$this->xmlWriter->endElement();
} else {
//probably just a primitive string
$this->xmlWriter->startElementNs(ODataConstants::ODATA_NAMESPACE_PREFIX, ODataConstants::COLLECTION_ELEMENT_NAME, null);
$this->xmlWriter->text($content);
$this->xmlWriter->endElement();
}
}
return $this;
}
示例10: build
public function build($name, $node, \XMLWriter &$writer, $under_root)
{
// always inside an xsd:element
$writer->startElementNs('xsd', 'element', null);
$writer->writeAttribute('name', $name);
$this->addRequired($node, $writer, $under_root);
// simpleType with restrictions
$writer->startElementNs('xsd', 'simpleType', null);
$writer->startElementNs('xsd', 'restriction', null);
$writer->writeAttribute('base', 'xsd:string');
$writer->startElementNs('xsd', 'pattern', null);
$writer->writeAttribute('value', $node[$this->xsd_generator->getFullName('pattern')]);
$writer->endElement();
$writer->endElement();
$writer->endElement();
$writer->endElement();
}
示例11: build
public function build($name, $node, \XMLWriter &$writer, $under_root)
{
$writer->startElementNs('xsd', 'element', null);
$writer->writeAttribute('name', $name);
$this->addRequired($node, $writer, $under_root);
// check min and max_items attributes
$min = isset($node[$this->xsd_generator->getFullName('min_items')]) ? $node[$this->xsd_generator->getFullName('min_items')] : '0';
$max = isset($node[$this->xsd_generator->getFullName('max_items')]) ? $node[$this->xsd_generator->getFullName('max_items')] : '200';
// complexType
// we can't validate the actual type of children nodes
$writer->startElementNs('xsd', 'complexType', null);
$writer->startElementNs('xsd', 'sequence', null);
$writer->startElementNs('xsd', 'any', null);
$writer->writeAttribute('minOccurs', $min);
$writer->writeAttribute('maxOccurs', $max);
$writer->endElement();
$writer->endElement();
$writer->endElement();
$writer->endElement();
}
示例12: build
public function build($name, $node, \XMLWriter &$writer, $under_root)
{
// always inside an xsd:element
$writer->startElementNs('xsd', 'element', null);
$writer->writeAttribute('name', $name);
$this->addRequired($node, $writer, $under_root);
// there are not way to represent a strict enum
// simpleType with restrictions
$writer->startElementNs('xsd', 'simpleType', null);
$writer->startElementNs('xsd', 'restriction', null);
$writer->writeAttribute('base', 'xsd:string');
foreach ($node[$this->xsd_generator->getFullName('values')] as $value) {
$writer->startElementNs('xsd', 'enumeration', null);
$writer->writeAttribute('value', $value);
$writer->endElement();
}
$writer->endElement();
$writer->endElement();
$writer->endElement();
}
示例13: writeXmlContents
/**
* Writes the contents of this Merge to an XML writer. The startElement is expected to be already provided.
*
* @param \XMLWriter $writer The XML writer.
*/
public function writeXmlContents(\XMLWriter $writer)
{
if ($this->resourcesToDelete) {
foreach ($this->resourcesToDelete as $i => $x) {
$writer->startElementNs('fs', 'resourceToDelete', null);
$x->writeXmlContents($writer);
$writer->endElement();
}
}
if ($this->resourcesToCopy) {
foreach ($this->resourcesToCopy as $i => $x) {
$writer->startElementNs('fs', 'resourceToCopy', null);
$x->writeXmlContents($writer);
$writer->endElement();
}
}
}
示例14: writeXmlContents
/**
* Writes the contents of this ChangeInfo to an XML writer. The startElement is expected to be already provided.
*
* @param \XMLWriter $writer The XML writer.
*/
public function writeXmlContents($writer)
{
if ($this->objectModifier) {
$writer->writeAttribute('objectModifier', $this->objectModifier);
}
if ($this->operation) {
$writer->writeAttribute('operation', $this->operation);
}
if ($this->reason) {
$writer->writeAttribute('reason', $this->reason);
}
if ($this->objectType) {
$writer->writeAttribute('objectType', $this->objectType);
}
if ($this->original) {
$writer->startElementNs('fs', 'original', null);
$this->original->writeXmlContents($writer);
$writer->endElement();
}
if ($this->parent) {
$writer->startElementNs('fs', 'parent', null);
$this->parent->writeXmlContents($writer);
$writer->endElement();
}
if ($this->removed) {
$writer->startElementNs('fs', 'removed', null);
$this->removed->writeXmlContents($writer);
$writer->endElement();
}
if ($this->resulting) {
$writer->startElementNs('fs', 'resulting', null);
$this->resulting->writeXmlContents($writer);
$writer->endElement();
}
}
示例15: writeXmlContents
/**
* Writes the contents of this HealthConfig to an XML writer. The startElement is expected to be already provided.
*
* @param \XMLWriter $writer The XML writer.
*/
public function writeXmlContents($writer)
{
if ($this->buildDate) {
$writer->startElementNs('fs', 'buildDate', null);
$writer->text($this->buildDate);
$writer->endElement();
}
if ($this->buildVersion) {
$writer->startElementNs('fs', 'buildVersion', null);
$writer->text($this->buildVersion);
$writer->endElement();
}
if ($this->databaseVersion) {
$writer->startElementNs('fs', 'databaseVersion', null);
$writer->text($this->databaseVersion);
$writer->endElement();
}
if ($this->platformVersion) {
$writer->startElementNs('fs', 'platformVersion', null);
$writer->text($this->platformVersion);
$writer->endElement();
}
}