本文整理汇总了PHP中DomDocument::createAttributeNs方法的典型用法代码示例。如果您正苦于以下问题:PHP DomDocument::createAttributeNs方法的具体用法?PHP DomDocument::createAttributeNs怎么用?PHP DomDocument::createAttributeNs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomDocument
的用法示例。
在下文中一共展示了DomDocument::createAttributeNs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addImportToSchema
/**
* Add xsd:import tag to XML schema before any childs added
*
* @param string $namespace Namespace URI
* @param string $code Shortcut for namespace, fx, ns0. Returned by getNsCode()
*
* @return void
*/
private function addImportToSchema($namespace, $code)
{
if (array_key_exists($namespace, $this->docNamespaces)) {
if (in_array($namespace, $this->importedNamespaces)) {
return;
}
//$dom = $this->wsdl->toDomDocument();
//print_r($namespace);
$this->dom->createAttributeNs($namespace, $code . ":definitions");
$importEl = $this->dom->createElement($this->xmlSchemaPreffix . ":import");
$nsAttr = $this->dom->createAttribute("namespace");
$txtNode = $this->dom->createTextNode($namespace);
$nsAttr->appendChild($txtNode);
$nsAttr2 = $this->dom->createAttribute("schemaLocation");
$schemaLocation = $this->getSchemaLocation($namespace);
$publicSchema = $this->copyToPublic($schemaLocation, true);
$publicSchema = $this->copyToPublic($schemaLocation, true);
$schemaUrl = $this->importsToAbsUrl($publicSchema, $this->getSchemasPath());
$txtNode2 = $this->dom->createTextNode($schemaUrl);
$nsAttr2->appendChild($txtNode2);
$importEl->appendChild($nsAttr);
$importEl->appendChild($nsAttr2);
//$this->wsdl->getSchema();
//$xpath = new \DOMXPath($this->dom);
//$query = "//*[local-name()='types']/child::*/*";
//$firstElement = $xpath->query($query);
//if (!is_object($firstElement->item(0))) {
// $query = "//*[local-name()='types']/child::*";
// $schema = $xpath->query($query);
// $schema->item(0)->appendChild($importEl);
//} else {
// $this->wsdl->getSchema()->insertBefore($importEl, $firstElement->item(0));
//}
//$this->xmlSchemaImports
//$this->wsXmlSchema->appendChild();
array_push($this->xmlSchemaImports, $importEl);
array_push($this->importedNamespaces, $namespace);
}
}