示例#1
0
文件: Page.java 项目: tolleiv/structr
  @Override
  public Element getElementById(final String id) {

    DOMNodeList results = new DOMNodeList();

    collectNodesByPredicate(
        this,
        results,
        new Predicate<Node>() {

          @Override
          public boolean accept(Node obj) {

            if (obj instanceof DOMElement) {

              DOMElement elem = (DOMElement) obj;

              if (id.equals(elem.getProperty(DOMElement._id))) {
                return true;
              }
            }

            return false;
          }
        },
        0,
        true);

    // return first result
    if (results.getLength() == 1) {
      return (DOMElement) results.item(0);
    }

    return null;
  }
示例#2
0
文件: Page.java 项目: tolleiv/structr
  @Override
  public NodeList getChildNodes() {

    DOMNodeList _children = new DOMNodeList();

    _children.add(docTypeNode);
    _children.addAll(super.getChildNodes());

    return _children;
  }