Retrieves the id of a log data hierarchy element, if set by this
extension's id attribute.

@param element
Log hierarchy element to extract name from.
@return The requested element id.
551134
public XID extractID(XAttributable element) {
		XAttribute attribute = element.getAttributes().get(KEY_ID);
		if (attribute == null) {
			return null;
		} else {
			return ((XAttributeID) attribute).getValue();
		}
	}
579531
@SuppressWarnings("static-method")
	protected int getIssueAdornment(XtendMember element) {
		final ICompositeNode node = NodeModelUtils.getNode(element);
		if (node == null) {
			return 0;
		}
		// Error markers are more important than warning markers.
		// Order of checks:
		// - parser error (from the resource) or semantic error (from Diagnostician)
		// - parser warning or semantic warning
		final Resource resource = element.eResource();
		if (!resource.getURI().isArchive()) {
			if (hasParserIssue(node, resource.getErrors())) {
				return JavaElementImageDescriptor.ERROR;
			}
			final Diagnostic diagnostic = Diagnostician.INSTANCE.validate(element);
	        switch (diagnostic.getSeverity()) {
	        case Diagnostic.ERROR:
	        	return JavaElementImageDescriptor.ERROR;
	        case Diagnostic.WARNING:
	        	return JavaElementImageDescriptor.WARNING;
	        default:
	        }
			if (hasParserIssue(node, resource.getWarnings())) {
				return JavaElementImageDescriptor.WARNING;
			}
		}
		return 0;
	}
1235481
def get_log_hierarchy_id(self):
        
        # Implemented from template for
        # osid.resource.BinHierarchySession.get_bin_hierarchy_id
        if self._catalog_session is not None:
            return self._catalog_session.get_catalog_hierarchy_id()
        return self._hierarchy_session.get_hierarchy_id()
489363
def get_parent_id(element):
        """"""
        if 'parent' in element.attrib:
            return element.attrib['parent']
        else:
            return element.getparent().attrib[add_ns('id')]
744514
public static Element getElement(Element element, String tagName) {
		final NodeList nodeList = element.getElementsByTagName(tagName);
		if (nodeList == null || nodeList.getLength() < 1) {
			return null;
		}
		int length = nodeList.getLength();
		for (int i = 0; i < length; i++) {
			Element childEle = (Element) nodeList.item(i);
			if (childEle == null || childEle.getParentNode() == element) {
				return childEle;
			}
		}
		return null;
	}
846577
private Object getMemberKey(Element element) {
        if (utils.isConstructor(element)) {
            return utils.getSimpleName(element) + utils.flatSignature((ExecutableElement)element);
        } else if (utils.isMethod(element)) {
            return getClassMember((ExecutableElement) element);
        } else if (utils.isField(element) || utils.isEnumConstant(element) || utils.isAnnotationType(element)) {
            return utils.getSimpleName(element);
        } else { // it's a class or interface
            String classOrIntName = utils.getSimpleName(element);
            //Strip off the containing class name because we only want the member name.
            classOrIntName = classOrIntName.indexOf('.') != 0
                    ? classOrIntName.substring(classOrIntName.lastIndexOf('.'))
                    : classOrIntName;
            return "clint" + classOrIntName;
        }
    }
384054
private Object parseXmlElement(Element element) {
        if(element.getFirstChild() instanceof Text) {
            Text text = (Text) element.getFirstChild();
            return text.getData();
        }
        return element;
    }
111207
public function generateElementId(Element $element) : string
    {
        preg_match('/^([a-zA-Z0-9]*)/', $element->getName(), $matches);
        $name = $matches[0];

        if (! isset($this->ids[$name])) {
            $this->ids[$name] = 0;
        }

        return $this->getId() . '-' . $name . '-' . $this->ids[$name]++;
    }
465484
public int getSortOrder(Element element) {
        String deepName = getDeepName(element);
        return elementNameSortOrderMap.get(deepName);
    }
1137121
@Nonnull
  @MustNotContainNull
  public static List<Element> findDirectChildrenForName(@Nonnull final Element element, @Nonnull final String childElementname) {
    final List<Element> resultList = new ArrayList<Element>();
    final NodeList list = element.getChildNodes();
    for (int i = 0; i < list.getLength(); i++) {
      final Node node = list.item(i);
      if (element.equals(node.getParentNode()) && node instanceof Element && childElementname.equals(node.getNodeName())) {
        resultList.add((Element) node);
      }
    }
    return resultList;
  }
520215
protected
  void parse(Element element) {

    String rootElementName = element.getTagName();

    if (!rootElementName.equals(CONFIGURATION_TAG)) {
      if(rootElementName.equals(OLD_CONFIGURATION_TAG)) {
	LogLog.warn("The <"+OLD_CONFIGURATION_TAG+
		     "> element has been deprecated.");
	LogLog.warn("Use the <"+CONFIGURATION_TAG+"> element instead.");
      } else {
	LogLog.error("DOM element is - not a <"+CONFIGURATION_TAG+"> element.");
	return;
      }
    }

    String debugAttrib = subst(element.getAttribute(INTERNAL_DEBUG_ATTR));
      
    LogLog.debug("debug attribute= \"" + debugAttrib +"\".");
    // if the log4j.dtd is not specified in the XML file, then the
    // "debug" attribute is returned as the empty string.
    if(!debugAttrib.equals("") && !debugAttrib.equals("null")) {      
      LogLog.setInternalDebugging(OptionConverter.toBoolean(debugAttrib, true));
    } else {
      LogLog.debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
    }

      //
      //   reset repository before configuration if reset="true"
      //       on configuration element.
      //
    String resetAttrib = subst(element.getAttribute(RESET_ATTR));
    LogLog.debug("reset attribute= \"" + resetAttrib +"\".");
    if(!("".equals(resetAttrib)) &&
         OptionConverter.toBoolean(resetAttrib, false)) {
         repository.resetConfiguration();
    }


    String confDebug = subst(element.getAttribute(CONFIG_DEBUG_ATTR));
    if(!confDebug.equals("") && !confDebug.equals("null")) {      
      LogLog.warn("The \""+CONFIG_DEBUG_ATTR+"\" attribute is deprecated.");
      LogLog.warn("Use the \""+INTERNAL_DEBUG_ATTR+"\" attribute instead.");
      LogLog.setInternalDebugging(OptionConverter.toBoolean(confDebug, true));
    }

    String thresholdStr = subst(element.getAttribute(THRESHOLD_ATTR));
    LogLog.debug("Threshold =\"" + thresholdStr +"\".");
    if(!"".equals(thresholdStr) && !"null".equals(thresholdStr)) {
      repository.setThreshold(thresholdStr);
    }

    //Hashtable appenderBag = new Hashtable(11);

    /* Building Appender objects, placing them in a local namespace
       for future reference */

    // First configure each category factory under the root element.
    // Category factories need to be configured before any of
    // categories they support.
    //
    String   tagName = null;
    Element  currentElement = null;
    Node     currentNode = null;
    NodeList children = element.getChildNodes();
    final int length = children.getLength();

    for (int loop = 0; loop < length; loop++) {
      currentNode = children.item(loop);
      if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
	currentElement = (Element) currentNode;
	tagName = currentElement.getTagName();

	if (tagName.equals(CATEGORY_FACTORY_TAG) || tagName.equals(LOGGER_FACTORY_TAG)) {
	  parseCategoryFactory(currentElement);
	}
      }
    }
    
    for (int loop = 0; loop < length; loop++) {
      currentNode = children.item(loop);
      if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
	currentElement = (Element) currentNode;
	tagName = currentElement.getTagName();

	if (tagName.equals(CATEGORY) || tagName.equals(LOGGER)) {
	  parseCategory(currentElement);
	} else if (tagName.equals(ROOT_TAG)) {
	  parseRoot(currentElement);
	} else if(tagName.equals(RENDERER_TAG)) {
	  parseRenderer(currentElement);
	} else if (!(tagName.equals(APPENDER_TAG)
            || tagName.equals(CATEGORY_FACTORY_TAG)
            || tagName.equals(LOGGER_FACTORY_TAG))) {
        quietParseUnrecognizedElement(repository, currentElement, props);
    }
      }
    }
  }
432412
public static Element getElementNode(final Element element, final DitaClass classValue) {
        final NodeList list = element.getChildNodes();
        for (int i = 0; i < list.getLength(); i++) {
            final Node node = list.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                final Element child = (Element) node;
                if (classValue.matches(child)) {
                    return child;
                }
            }
        }
        return null;
    }
17127
private static String getText(Element element) {
    if (element.getFirstChild() == null) {
      return "";
    }
    return ((Text) element.getFirstChild()).getData().trim();
  }
1100023
public static TypeElement getTypeElement(Types typeUtils, Element element) {
		TypeMirror type = element.asType();
		return (TypeElement) typeUtils.asElement(type);
	}
1285524
private static Element getFirstNamedElement(Element element, String name) {
		NodeList list = element.getElementsByTagName(name);
		if (list.getLength() == 0) {
			return null;
		}

		return (Element) list.item(0);
	}
958755
public static String extractPackageName(TypeElement element) {
		String fullName = element.getQualifiedName().toString();

		if (fullName.lastIndexOf(".") > 0) {
			return fullName.substring(0, fullName.lastIndexOf("."));
		}
		return "";
	}
20731
public static Element getAncestor(Element element, Tag tag) {

        if ((element == null) || (tag == null)) {
            return null;
        }
        if (element.getTagName().equalsIgnoreCase(tag.name())) {
            return element;
        }
        if (element.getTagName().equalsIgnoreCase(Tag.body.name())) {
            return null;
        }
        return getAncestor(element.getParentElement(), tag);
    }