Parse xpath for any attribute reference "path/@attr" and check for root and presence of attribute.
    :return: True if xpath is present in the element along with any attribute referenced, otherwise False
334682
def has_property(elem_to_parse, xpath):
    

    xroot, attr = get_xpath_tuple(xpath)

    if not xroot and not attr:
        return False
    elif not attr:
        return bool(get_elements_text(elem_to_parse, xroot))
    else:
        return bool(get_elements_attributes(elem_to_parse, xroot, attr))
83010
public boolean find(String xmlPathQuery) {
        XmlPath xmlPath = XmlPathParser.parse(xmlPathQuery);

        XmlNode node;
        while((node = pullXmlNode()) != null) {
            if(node instanceof XmlStartElement) {
                XmlStartElement startElement = (XmlStartElement) node;
                Element element = new Element(startElement.getLocalName());
                element.addAttributes(startElement.getAttributes());
                currentPath.addLast(element);
                if(xmlPath.matches(currentPath)) {
                    nodeQueue.push(node);
                    currentPath.removeLast();
                    return true;
                }
            } else if(node instanceof XmlEndElement) {
                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.removeLast();
            } else if(node instanceof XmlContent) {
                XmlContent content = (XmlContent) node;
                if(currentPath.getLast() instanceof Content) {
                    currentPath.removeLast();
                }
                currentPath.addLast(new Content(content.getText()));
            } else {
                throw new XmlReaderException("Unknown XmlNode type: " + node);
            }
        }
        return false;
    }
829702
def get_attr(obj, path):
    
    try:
        return _get_attr(obj, split_field(path))
    except Exception as e:
        Log = get_logger()
        if PATH_NOT_FOUND in e:
            Log.error(PATH_NOT_FOUND+": {{path}}",  path=path, cause=e)
        else:
            Log.error("Problem setting value", e)
135310
def path_has(self, **kwargs):
            
            str_node    = "/" # This node will always be "False"
            for key, val in kwargs.items():
                if key == 'node':   str_node = val
            if str_node in self.l_cwd:
                return { 'found':   True,
                         'indices': [i for i, x in enumerate(self.l_cwd) if x == str_node]}
            else:
                return { 'found':   False,
                         'indices': [-1]}
352979
def has_attr(cls, attr_name):
    """"""
    if attr_name in cls.attrs:
      return True

    if isinstance(cls.primary_key_name, str) and cls.primary_key_name == attr_name:
      return True

    if isinstance(cls.primary_key_name, tuple) and attr_name in cls.primary_key_name:
      return True

    if cls.timestamps is not None and attr_name in cls.timestamps:
      return True

    return False
322255
def element_is_empty(elem_to_parse, element_path=None):
    

    element = get_element(elem_to_parse, element_path)

    if element is None:
        return True

    is_empty = (
        (element.text is None or not element.text.strip()) and
        (element.tail is None or not element.tail.strip()) and
        (element.attrib is None or not len(element.attrib)) and
        (not len(element.getchildren()))
    )

    return is_empty
318743
def attr_match(cond)
      cond.each_pair { |k,v| return false unless v == @attributes[k.to_sym] || v == @attributes[k.to_s] }
      true
    end
164214
def find_elements_by_xpath(self, xpath):
        
        from sdklib.html.elem import Elem5lib

        return [Elem5lib(e) for e in self.html_obj.findall(self._convert_xpath(xpath))]
1168868
public function checkElementsInHead($path, $attribute)
    {
        foreach ($this->_head as $element) {
            if (basename($element->getAttribute($attribute)) == basename($path)) {
                return true;
            }
        }

        return false;
    }
554419
def isRef(self, elem, attr):
        
        if elem is None: elem__o = None
        else: elem__o = elem._o
        if attr is None: attr__o = None
        else: attr__o = attr._o
        ret = libxml2mod.xmlIsRef(self._o, elem__o, attr__o)
        return ret
615031
def is_html_link(cls, tag, attribute):
        ''''''
        if tag in cls.TAG_ATTRIBUTES \
           and attribute in cls.TAG_ATTRIBUTES[tag]:
            attr_flags = cls.TAG_ATTRIBUTES[tag][attribute]
            return attr_flags & cls.ATTR_HTML

        return attribute == 'href'
1266157
def get_attribute(file, element):
    '''
    
    '''
    try:
        root = ET.parse(file)
        element = root.find(element)
        return element.attrib
    except AttributeError:
        log.error("Unable to find element matching %s", element)
        return False
317779
def _checkpath(self, path):
        
        if path.startswith("/") or ".." in path or path.strip() != path:
            raise NotFoundException()
200366
def xpathNewParserContext(self, str):
        
        ret = libxml2mod.xmlXPathNewParserContext(str, self._o)
        if ret is None:raise xpathError('xmlXPathNewParserContext() failed')
        __tmp = xpathParserContext(_obj=ret)
        return __tmp
1108050
def _eval_xpath(self, xpath):
        
        if isinstance(xpath, etree.XPath):
            result = xpath(self._dataObject)
        else:
            result = self._dataObject.xpath(xpath,namespaces=self._namespaces)

        #print 'Xpath expression:', xpath
        #print etree.tostring(self._dataObject)
        #print 'Got Result: \n%s\n   End Result' % result

        return result
1119554
def get_attribute_at(config, target_path, key, default_value=None):
    
    for target in target_path:
        config = config[target]
    return config[key] if key in config else default_value
1313925
def xpathEval(self, str):
        
        ret = libxml2mod.xmlXPathEval(str, self._o)
        if ret is None:raise xpathError('xmlXPathEval() failed')
        return xpathObjectRet(ret)