Esempio n. 1
0
  /**
   * Method getElementById
   *
   * @param doc
   * @param id
   * @return the element obtained by the Id, or null if it is not found.
   */
  public static Element getElementById(Document doc, String id) {

    Element result = null;

    result = IdResolver.getElementByIdType(doc, id);

    if (result != null) {
      return result;
    }

    result = IdResolver.getElementByIdUsingDOM(doc, id);

    if (result != null) {
      return result;
    }
    // this must be done so that Xalan can catch ALL namespaces
    // XMLUtils.circumventBug2650(doc);
    result = IdResolver.getElementBySearching(doc, id);

    if (result != null) {
      IdResolver.registerElementById(result, id);

      return result;
    }

    return null;
  }
Esempio n. 2
0
 /**
  * Method registerElementById
  *
  * @param element
  * @param id
  */
 public static void registerElementById(Element element, Attr id) {
   IdResolver.registerElementById(element, id.getNodeValue());
 }