extract the content of a attribut

@param cfxdTag
@param attrName
@return attribute value
@throws EvaluatorException
169619
public static Literal getAttributeLiteral(Tag tag, String attrName) throws EvaluatorException {
	Attribute attr = tag.getAttribute(attrName);
	if (attr != null && attr.getValue() instanceof Literal) return ((Literal) attr.getValue());
	throw new EvaluatorException("attribute [" + attrName + "] must be a constant value");
    }
993249
public Object getAttribute(String attrName) {
        Lock lock = lockForRead();
        try {
            return attributes != null ? attributes.get(attrName) : null;
        } finally {
            lock.unlock();
        }
    }
98611
def _extract(self, attribute) -> str:
        """"""
        attr_data = self.journey.JourneyAttributeList.JourneyAttribute[
            self.attr_types.index(attribute)
        ].Attribute
        attr_variants = attr_data.xpath("AttributeVariant/@type")
        data = attr_data.AttributeVariant[attr_variants.index("NORMAL")].Text.pyval
        return str(data)
786269
public static String getTagAttr(StringBuilder page, final String tag,
			final String attr) {

		String found = null;
		Pattern daPattern = TagMagix.getPattern(tag, attr);
		Matcher matcher = daPattern.matcher(page);
		int idx = 0;

		if (matcher.find(idx)) {
			found = matcher.group(1);
			found = trimAttrValue(found);
		}

		return found;
	}
197975
def _read_attr(attr_name):
    
    regex = attr_name + r"\s+=\s+'(.+)'"
    if sys.version_info.major == 2:
        with open('pefile.py', 'r') as f:
            match = re.search(regex, f.read())
    else:
        with open('pefile.py', 'r', encoding='utf-8') as f:
            match = re.search(regex, f.read())
    # Second item in the group is the value of attribute.
    return match.group(1)
233081
function _attr(el, attr, attrs, i) {
        var result = (el.getAttribute && el.getAttribute(attr)) || 0;

        if (!result) {
            attrs = el.attributes;

            for (i = 0; i < attrs.length; ++i) {
                if (attrs[i].nodeName === attr) {
                    return attrs[i].nodeValue;
                }
            }
        }

        return result;
    }
38862
function getHTMLAttribute(node, attrName) {
	attrName = attrName.toLowerCase();
	return node && node.attributes.find(attr => attr.name.value.toLowerCase() === attrName);
}
1355894
private Attribute extract(String name) {
		final AttributeValue value;
		if (this.cache.containsKey(name)) {
			value = this.cache.get(name);
		} else {
			final ManyValueAttributeValue result = new ManyValueAttributeValue();
			AttributeValue attrValue;
			for (final AttributeProvider c : this.containers) {
				attrValue = c.getAttribute(name);
				assign(result, attrValue);
			}
			value = canonize(result);
			this.cache.put(name, value);
		}
		return (value != null) ? new AttributeImpl(name, value) : null;
	}
556148
def getAttribute(self):
        """"""
        data = self.data
        # Step 1 (skip chars)
        c = data.skip(spaceCharactersBytes | frozenset([b"/"]))
        assert c is None or len(c) == 1
        # Step 2
        if c in (b">", None):
            return None
        # Step 3
        attrName = []
        attrValue = []
        # Step 4 attribute name
        while True:
            if c == b"=" and attrName:
                break
            elif c in spaceCharactersBytes:
                # Step 6!
                c = data.skip()
                break
            elif c in (b"/", b">"):
                return b"".join(attrName), b""
            elif c in asciiUppercaseBytes:
                attrName.append(c.lower())
            elif c is None:
                return None
            else:
                attrName.append(c)
            # Step 5
            c = next(data)
        # Step 7
        if c != b"=":
            data.previous()
            return b"".join(attrName), b""
        # Step 8
        next(data)
        # Step 9
        c = data.skip()
        # Step 10
        if c in (b"'", b'"'):
            # 10.1
            quoteChar = c
            while True:
                # 10.2
                c = next(data)
                # 10.3
                if c == quoteChar:
                    next(data)
                    return b"".join(attrName), b"".join(attrValue)
                # 10.4
                elif c in asciiUppercaseBytes:
                    attrValue.append(c.lower())
                # 10.5
                else:
                    attrValue.append(c)
        elif c == b">":
            return b"".join(attrName), b""
        elif c in asciiUppercaseBytes:
            attrValue.append(c.lower())
        elif c is None:
            return None
        else:
            attrValue.append(c)
        # Step 11
        while True:
            c = next(data)
            if c in spacesAngleBrackets:
                return b"".join(attrName), b"".join(attrValue)
            elif c in asciiUppercaseBytes:
                attrValue.append(c.lower())
            elif c is None:
                return None
            else:
                attrValue.append(c)
1105600
@Nullable
  public HtmlAttributeNode getDirectAttributeNamed(String attrName) {
    // the child at index 0 is the tag name
    for (int i = 1; i < numChildren(); i++) {
      StandaloneNode child = getChild(i);
      if (child instanceof HtmlAttributeNode) {
        HtmlAttributeNode attr = (HtmlAttributeNode) child;
        if (attr.definitelyMatchesAttributeName(attrName)) {
          return attr;
        }
      }
    }
    return null;
  }
254992
static String getAttributeValue(Element element, String name) {
        Attr attribute = element.getAttributeNode(name);
        if (attribute == null) {
            return null;
        } else {
            return attribute.getValue();
        }
    }
122867
public static String getAttribute(URI uri, String attributeName)
	{
		String query = uri.getQuery();
		if(StringUtil.isEmpty(query)) return null;

		Pattern pattern = Pattern.compile( attributeName + "\\=([^&]*)" );
		Matcher matcher = pattern.matcher( query );

		if (matcher.find())
			return matcher.group( 1 );
		else
			return null;
	}
325718
public static String getAttributeString(Tag tag, String attrName, String defaultValue) {
	Literal lit = getAttributeLiteral(tag, attrName, null);
	if (lit == null) return defaultValue;
	return lit.getString();
    }
151129
@Override
	public Object getFwkAttribute(final String name) {
		if (attribMap == null) {
			return null;
		}
		return attribMap.get(name);
	}
296500
private void parseAttribute(final Attributes atts) {
        URI target = toURI(atts.getValue(ATTRIBUTE_NAME_COPY_TO));
        if (target == null) {
            return;
        }
        final String attrScope = atts.getValue(ATTRIBUTE_NAME_SCOPE);

        // external resource is filtered here.
        if (ATTR_SCOPE_VALUE_EXTERNAL.equals(attrScope) || ATTR_SCOPE_VALUE_PEER.equals(attrScope)
                // FIXME: testing for :// here is incorrect, rely on source scope instead
                || target.toString().contains(COLON_DOUBLE_SLASH) || target.toString().startsWith(SHARP)) {
            return;
        }

        final URI targetAbs = stripFragment(target.isAbsolute() ? target : currentFile.resolve(target));
        assert targetAbs.isAbsolute();

        final String attrFormat = getFormat(atts);

        if (isFormatDita(attrFormat)) {
            final URI source = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
            if (source != null) {
                if (source.toString().isEmpty()) {
                    logger.warn("Copy-to task [href=\"\" copy-to=\"" + targetAbs + "\"] was ignored.");
                } else {
                    final URI sourceAbs = stripFragment(currentFile.resolve(source));
                    assert sourceAbs.isAbsolute();
                    final URI copyToSourceAbs = copyToMap.get(targetAbs);
                    if (copyToSourceAbs != null) {
                        if (!sourceAbs.equals(copyToSourceAbs)) {
                            logger.warn(MessageUtils.getMessage("DOTX065W", source.toString(), targetAbs.toString()).toString());
                        }
                    } else if (atts.getValue(ATTRIBUTE_NAME_CHUNK) != null &&
                            atts.getValue(ATTRIBUTE_NAME_CHUNK).contains(CHUNK_TO_CONTENT)) {
                        // Ignore
                    } else {
                        copyToMap.put(targetAbs, sourceAbs);
                    }
                }
            }
        }
    }
783225
private AstNode attributeAccess()
        throws IOException
    {
        int tt = nextToken(), atPos = ts.tokenBeg;

        switch (tt) {
          // handles: @name, @ns::name, @ns::*, @ns::[expr]
          case Token.NAME:
              return propertyName(atPos, ts.getString(), 0);

          // handles: @*, @*::name, @*::*, @*::[expr]
          case Token.MUL:
              saveNameTokenData(ts.tokenBeg, "*", ts.lineno);
              return propertyName(atPos, "*", 0);

          // handles @[expr]
          case Token.LB:
              return xmlElemRef(atPos, null, -1);

          default:
              reportError("msg.no.name.after.xmlAttr");
              return makeErrorNode();
        }
    }
68693
static final String attr(Element element, String name) {
        return attr(element, name, true);
    }