本文整理汇总了PHP中DOMElement::hasAttributeNS方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMElement::hasAttributeNS方法的具体用法?PHP DOMElement::hasAttributeNS怎么用?PHP DOMElement::hasAttributeNS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMElement
的用法示例。
在下文中一共展示了DOMElement::hasAttributeNS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a PAOS Request element.
*
* @param DOMElement|NULL $xml The XML element we should load.
*/
public function __construct(DOMElement $xml = NULL)
{
if ($xml === NULL) {
return;
}
if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand')) {
throw new Exception('Missing soap-env:mustUnderstand attribute in <paos:Request>.');
} elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand') !== '1') {
throw new Exception('Invalid value of soap-env:mustUnderstand attribute in <paos:Request>.');
}
if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'actor')) {
throw new Exception('Missing soap-env:mustUnderstand attribute in <paos:Request>.');
} elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'actor') !== 'http://schemas.xmlsoap.org/soap/actor/next') {
throw new Exception('Invalid value of soap-env:actor attribute in <paos:Request>.');
}
if (!$xml->hasAttribute('responseConsumerURL')) {
throw new Exception('Missing responseConsumerURL attribute in <paos:Request>.');
}
$this->responseConsumerURL = $xml->getAttribute('responseConsumerURL');
if (!$xml->hasAttribute('service')) {
throw new Exception('Missing service attribute in <paos:Request>.');
}
$this->service = $xml->getAttribute('service');
if ($xml->hasAttribute('messageID')) {
$this->messageID = $xml->getAttribute('messageID');
}
}
示例2: checkXML
/**
* Basic check of the given XML, it is not part of __construct in order to reduce NPath Complexity
*
* @param DOMElement|NULL $xml The XML element we should check before loading.
*/
public function checkXML(DOMElement $xml)
{
if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand')) {
return 'Missing soap-env:mustUnderstand attribute in <ecp:Request>.';
} elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand') !== '1') {
return 'Invalid value of soap-env:mustUnderstand attribute in <ecp:Request>.';
}
if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'actor')) {
return 'Missing soap-env:mustUnderstand attribute in <ecp:Request>.';
} elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'actor') !== 'http://schemas.xmlsoap.org/soap/actor/next') {
return 'Invalid value of soap-env:actor attribute in <ecp:Request>.';
}
return TRUE;
}
示例3: parseStyles
/**
* @param DOMElement $element
* @param array $style
* @return array
*/
function parseStyles(DOMElement $element, $style = array())
{
if ($element->hasAttributeNS($this->ttsNS, 'fontWeight') && $element->getAttributeNS($this->ttsNS, 'fontWeight') == 'bold') {
$style['bold'] = true;
}
if ($element->hasAttributeNS($this->ttsNS, 'fontStyle') && $element->getAttributeNS($this->ttsNS, 'fontStyle') == 'italic') {
$style['italic'] = true;
}
$copiedAtts = array('textAlign', 'displayAlign', 'color', 'backgroundColor', 'fontFamily', 'fontSize');
foreach ($copiedAtts as $copiedAtt) {
if ($element->hasAttributeNS($this->ttsNS, $copiedAtt)) {
$style[$copiedAtt] = $element->getAttributeNS($this->ttsNS, $copiedAtt);
}
}
return $style;
}
示例4: __construct
/**
* Create a ECP RelayState element.
*
* @param DOMElement|NULL $xml The XML element we should load.
*/
public function __construct(DOMElement $xml = NULL)
{
if ($xml === NULL) {
return;
}
if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand')) {
throw new Exception('Missing soap-env:mustUnderstand attribute in <ecp:RelayState>.');
} elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'mustUnderstand') !== '1') {
throw new Exception('Invalid value of soap-env:mustUnderstand attribute in <ecp:RelayState>.');
}
if (!$xml->hasAttributeNS(SAML2_Const::NS_SOAP, 'actor')) {
throw new Exception('Missing soap-env:mustUnderstand attribute in <ecp:RelayState>.');
} elseif ($xml->getAttributeNS(SAML2_Const::NS_SOAP, 'actor') !== 'http://schemas.xmlsoap.org/soap/actor/next') {
throw new Exception('Invalid value of soap-env:actor attribute in <ecp:RelayState>.');
}
$this->RelayState = $xml->textContent;
}
示例5: offsetExists
/**
* Required by the ArrayAccess interface.
*
* @param string $offset
* @return boolean
*/
public function offsetExists($offset)
{
if (strpos($offset, ':') !== false) {
list($ns, $attr) = explode(':', $offset, 2);
return $this->_element->hasAttributeNS(Zend_Feed::lookupNamespace($ns), $attr);
} else {
return $this->_element->hasAttribute($offset);
}
}
示例6: hasAttribute
/**
* Validate if an attribute exists
*
* @param string $name
* @return bool
*/
public function hasAttribute($name)
{
list($namespace, $localName) = $this->resolveTagName($name);
if ($namespace != '') {
return parent::hasAttributeNS($namespace, $localName);
} else {
return parent::hasAttribute($name);
}
}
示例7: isElementValueNull
private function isElementValueNull(\DOMElement $element)
{
$namespaceUri = 'http://www.w3.org/2001/XMLSchema-instance';
if (!$element->hasAttributeNS($namespaceUri, 'nil')) {
return false;
}
return 'true' === $element->getAttributeNS($namespaceUri, 'nil') || '1' === $element->getAttributeNS($namespaceUri, 'nil');
}
示例8: getChildAttribute
public function getChildAttribute(\DOMElement $node)
{
$name = $node->getAttributeNS($this->namespaces['sv'], 'name');
$type = strtolower($node->getAttributeNS($this->namespaces['sv'], 'type'));
$values = array();
if ($name == 'jcr:created') {
$values[] = date(self::DATEFORMAT);
} else {
foreach ($node->getElementsByTagNameNS($this->namespaces['sv'], 'value') as $nodeValue) {
$values[] = $nodeValue->nodeValue;
}
}
$isMultiValue = false;
if ($name == 'jcr:mixinTypes' || count($values) > 1 || $node->hasAttributeNS($this->namespaces['sv'], 'multiple') && $node->getAttributeNS($this->namespaces['sv'], 'multiple') == 'true') {
$isMultiValue = true;
}
return array($name, array('type' => $type, 'value' => $values, 'multiValued' => $isMultiValue));
}
示例9: getType
/**
* @param \DOMElement $node
* @return string
*/
private function getType(\DOMElement $node)
{
if ($node->hasAttributeNS(self::XMLNS_JSONDOM, 'type')) {
return $node->getAttributeNS(self::XMLNS_JSONDOM, 'type');
} else {
$xpath = new Xpath($node->ownerDocument);
return $xpath('count(*) > 0', $node) ? 'object' : 'string';
}
}
示例10: parseTextInput
/**
* Parses the provided XML element object and stores it as a feed textinput in
* the provided ezcFeed object.
*
* @param ezcFeed $feed The feed object in which to store the parsed XML element as a feed textinput
* @param DOMElement $xml The XML element object to parse
*/
private function parseTextInput(ezcFeed $feed, DOMElement $xml = null)
{
$textInput = $feed->add('textInput');
if ($xml !== null) {
foreach ($xml->childNodes as $itemChild) {
if ($itemChild->nodeType == XML_ELEMENT_NODE) {
$tagName = $itemChild->tagName;
switch ($tagName) {
case 'title':
case 'description':
case 'name':
case 'link':
$textInput->{$tagName} = $itemChild->textContent;
break;
}
}
}
if ($xml->hasAttributeNS(self::NAMESPACE_URI, 'about')) {
$textInput->about = $xml->getAttributeNS(self::NAMESPACE_URI, 'about');
}
}
}
示例11: get_attr_value
/**
* Get a attribute value
*
* @param DOMElement $nod
* @param string $name
* @param string $ns
* @return string
*/
public function get_attr_value(&$nod, $name, $ns = null)
{
return is_null($ns) ? $nod->hasAttribute($name) ? $nod->getAttribute($name) : null : ($nod->hasAttributeNS($ns, $name) ? $nod->getAttributeNS($ns, $name) : null);
}
示例12: getListStyleName
/**
* Returns the list style name of the given $odtElement.
*
* Recursively searches for the style name of the given list element. The
* style name is only present at the top most list (for nested lists).
*
* @param DOMElement $odtElement
* @return string
*/
protected function getListStyleName(DOMElement $odtElement)
{
if ($odtElement->namespaceURI === ezcDocumentOdt::NS_ODT_TEXT && $odtElement->localName === 'list' && $odtElement->hasAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'style-name')) {
return $odtElement->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'style-name');
}
if ($odtElement->parentNode === null) {
throw new RuntimeException('No list style name found.');
}
return $this->getListStyleName($odtElement->parentNode);
}
示例13: parseListLevel
/**
* Parses a list level style.
*
* Parses the given $listLevelElement and returns a corresponding
* list-level style object.
*
* @param DOMElement $listLevelElement
* @return ezcDocumentOdtListLevelStyle
*/
protected function parseListLevel(DOMElement $listLevelElement)
{
if (!isset(self::$listClassMap[$listLevelElement->localName])) {
throw new RuntimeException("Unknown list-level element {$listLevelElement->localName}.");
}
$listLevelClass = self::$listClassMap[$listLevelElement->localName];
$listLevel = new $listLevelClass($listLevelElement->getAttributeNS(ezcDocumentOdt::NS_ODT_TEXT, 'level'));
foreach (self::$listAttributeMap[$listLevelElement->localName] as $ns => $attrs) {
foreach ($attrs as $xmlAttr => $objAttr) {
if ($listLevelElement->hasAttributeNS($ns, $xmlAttr)) {
$listLevel->{$objAttr} = $listLevelElement->getAttributeNS($ns, $xmlAttr);
}
}
}
return $listLevel;
}
示例14: getName
/**
* @param \DOMElement $node
* @return string
*/
private function getName(\DOMElement $node)
{
if ($node->hasAttributeNS(self::XMLNS_JSONDOM, 'name')) {
return $node->getAttributeNS(self::XMLNS_JSONDOM, 'name');
} else {
return $node->localName;
}
}
示例15: parseScriptTask
protected function parseScriptTask($id, \DOMElement $el, BusinessProcessBuilder $builder)
{
if ($el->hasAttributeNS(self::NS_IMPL, 'resource')) {
$scriptTask = $builder->scriptResourceTask($id, $el->getAttributeNS(self::NS_IMPL, 'resource'), $el->getAttribute('name'));
} else {
$script = '';
foreach ($this->xpath->query('m:script', $el) as $scriptElement) {
$script .= $scriptElement->textContent;
}
$scriptTask = $builder->scriptTask($id, $el->getAttribute('scriptFormat'), $script, $el->getAttribute('name'));
}
$scriptTask->setDocumentation($builder->stringExp($this->getDocumentation($el)));
$scriptTask->setAsyncBefore($this->getAsyncBefore($el));
$scriptTask->setAsyncAfter($this->getAsyncAfter($el));
if ($el->hasAttributeNS(self::NS_IMPL, 'resultVariable')) {
$scriptTask->setResultVariable($el->getAttributeNS(self::NS_IMPL, 'resultVariable'));
}
return $scriptTask;
}