return node attribut value in boolean
@param type $xPath
@param type $atrName
@param type $failReturn
@return boolean
330232
public function getNodeAttributeBool($xPath,$atrName,$failReturn = false){
        $val = $this->getNodeAttribute($xPath, $atrName);
        // string sets true/false
        if (strtolower($val) === 'false'){
            return false;
        }
        if (strtolower($val) === 'true'){
            return true;
        }
        if ($val === NULL || !is_bool($val)){

            return $failReturn;
        }
        return (bool) $val;
    }
719732
public static function selectNodes(\DOMNode $pNode, $xPath, $arNamespace = null) // <- Retorna N&#65533;!
    {
        if (preg_match('~^/[^/]~', $xPath)) {
            $xPath = substr($xPath, 1);
        }

        $owner = XmlUtil::getOwnerDocument($pNode);
        $xpath = new DOMXPath($owner);
        XmlUtil::registerNamespaceForFilter($xpath, $arNamespace);
        $rNodeList = $xpath->query($xPath, $pNode);

        return $rNodeList;
    }
1340647
public static function getFirstElementValueByXpath($node, $xpath_query, $namespaces = array())
    {
        $node = XMLTool :: getFirstElementByXpath($node, $xpath_query, $namespaces);

        if (isset($node))
        {
            return $node->nodeValue;
        }
        else
        {
            return null;
        }
    }
453030
public function getAttributeFromXML($attribute, \SimpleXMLElement $xmlDocument)
    {
        /** @var \SimpleXMLElement $value */
        foreach ($xmlDocument->attributes() as $key => $value) {
            /** @var \SimpleXMLElement $attribute */
            if ($attribute === $key) {
                return (string) ($this->xmlToArray($value)[0]);
            }
        }

        return false;
    }
1000620
public static function getFirstElementByXpath($node, $xpath_query, $namespaces = array())
    {
        if(is_a($node, 'DOMDocument'))
        {
            $xpath = new DOMXPath($node);
        }
        elseif(is_a($node, 'DOMNode'))
        {
            $xpath = new DOMXPath($node->ownerDocument);
        }
        else
        {
            return null;
        }

        foreach($namespaces as $prefix => $namespaceURI)
        {
            $xpath->registerNamespace($prefix, $namespaceURI);
        }

        $node_list = $xpath->query($xpath_query, $node);

        if ($node_list->length > 0)
        {
            return $node_list->item(0);
        }
        else
        {
            return null;
        }
    }
1115977
@Nullable
  private static RawTextNode getAttributeValue(
      HtmlTagNode tagNode, String name, ErrorReporter errorReporter) {
    HtmlAttributeNode attribute = tagNode.getDirectAttributeNamed(name);
    if (attribute == null) {
      return null;
    }
    RawTextNode value = getAttributeValue(attribute, name, errorReporter);
    // Remove it, we don't actually want to render it
    tagNode.removeChild(attribute);
    return value;
  }
662200
public function GetReturnType( $dataPool )
	{
		/**
		 * @var XPath2ResultType $res1
		 * @var XPath2ResultType $res2
		 */
		$res1 = $this->getAbstractNode(1)->GetReturnType( $dataPool );
		$res2 = $this->getAbstractNode(2)->GetReturnType( $dataPool );
		if ( $res1 == $res2 )
			return $res1;
		return XPath2ResultType::Any;
	}
260567
public function replyXml(array $data, $isReturn = false)
    {
        $xml = Tools::arr2xml($data);
        if ($isReturn) {
            return $xml;
        }
        ob_clean();
        exit($xml);
    }
512607
@Override
	NodeList eval(XMLResource resource) throws Exception {
		NodeList retVal = (NodeList) xPathExpression.evaluate(resource.doc(), XPathConstants.NODESET);
		return retVal;
	}
1309372
public function matchIfNotNullReturnValue(If_ $ifNode): ?Expr
    {
        if (count($ifNode->stmts) !== 1) {
            return null;
        }

        $insideIfNode = $ifNode->stmts[0];
        if (! $insideIfNode instanceof Return_) {
            return null;
        }

        /** @var Return_ $returnNode */
        $returnNode = $insideIfNode;
        if (! $ifNode->cond instanceof NotIdentical) {
            return null;
        }

        return $this->matchComparedAndReturnedNode($ifNode->cond, $returnNode);
    }
441803
public static function getBooleanValueFromXPath($path, \DOMXPath $xpath, \DomNode $context = null, $default = null)
    {
        $value = self::getValueFromXPath($path, $xpath, $context, $default);

        if (null === $value) {
            return;
        }

        return 'true' === $value || true === $value;
    }
644572
public function toXml(array $data, $isReturn = false)
    {
        $xml = Tools::arr2xml($data);
        if ($isReturn) {
            return $xml;
        }
        echo $xml;
    }
325620
function is_link($new = null, $return_entity = false)
    {
        if (isset($new) && ($this->_attributes['is_link'] != $new)){
            $this->change('is_link', (bool)$new);
        }
        if ($return_entity){
            if (!isset($this->_link)){
                if (empty($this->_attributes['is_link'])){
                    $this->_link = false;
                }else
                if (($this->_link = $this->proto(null, true))){
                    if ($p = $this->_link->is_link(null, true)) $this->_link = $p;
                }
            }
            return $this->_link;
        }
        return $this->_attributes['is_link'];
    }
442061
public static function getChildElements($element, $withText = false)
    {
        $children = $element->childNodes;
        $returnValue = array();
        
        for ($i = 0; $i < $children->length; $i++) {
            if ($children->item($i)->nodeType === XML_ELEMENT_NODE || ($withText === true && ($children->item($i)->nodeType === XML_TEXT_NODE || $children->item($i)->nodeType === XML_CDATA_SECTION_NODE))) {
                $returnValue[] = $children->item($i);
            }
        }
        
        return $returnValue;
    }
566901
public static function dump(XMLReader $reader, $return = FALSE)
    {
        $node = new self($reader);

        $nodeType = $reader->nodeType;
        $nodeName = $node->getNodeTypeName();

        $extra = '';

        if ($reader->nodeType === XMLReader::ELEMENT) {
            $extra = '<' . $reader->name . '> ';
            $extra .= sprintf("(isEmptyElement: %s) ", $reader->isEmptyElement ? 'Yes' : 'No');
        }

        if ($reader->nodeType === XMLReader::END_ELEMENT) {
            $extra = '</' . $reader->name . '> ';
        }

        if ($reader->nodeType === XMLReader::ATTRIBUTE) {
            $str = $reader->value;
            $len = strlen($str);
            if ($len > 20) {
                $str = substr($str, 0, 17) . '...';
            }
            $str   = strtr($str, array("\n" => '\n'));
            $extra = sprintf('%s = (%d) "%s" ', $reader->name, strlen($str), $str);
        }

        if ($reader->nodeType === XMLReader::TEXT || $reader->nodeType === XMLReader::WHITESPACE || $reader->nodeType === XMLReader::SIGNIFICANT_WHITESPACE) {
            $str = $reader->readString();
            $len = strlen($str);
            if ($len > 20) {
                $str = substr($str, 0, 17) . '...';
            }
            $str   = strtr($str, array("\n" => '\n'));
            $extra = sprintf('(%d) "%s" ', strlen($str), $str);
        }

        $label = sprintf("(#%d) %s %s", $nodeType, $nodeName, $extra);

        if ($return) {
            return $label;
        }

        printf("%s%s\n", str_repeat('  ', $reader->depth), $label);

        return null;
    }
1365484
Boolean getBooleanAttribute(org.w3c.dom.Node attribute)  {
    String s = getStringAttribute(attribute);

    if (s == null) {
      return null;
    }

    return Boolean.parseBoolean(s);
  }
443543
def xpathNextAttribute(self, cur):
        
        if cur is None: cur__o = None
        else: cur__o = cur._o
        ret = libxml2mod.xmlXPathNextAttribute(self._o, cur__o)
        if ret is None:raise xpathError('xmlXPathNextAttribute() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp