예제 #1
0
 Namespace[] getNamespaceDeclarations() {
   //    ECMA357 13.4.4.24
   if (this.dom instanceof Element) {
     Namespaces rv = new Namespaces();
     addNamespaces(rv, (Element) this.dom);
     return rv.getNamespaces();
   } else {
     return new Namespace[0];
   }
 }
예제 #2
0
  private Namespaces getAllNamespaces() {
    Namespaces rv = new Namespaces();

    Node target = this.dom;
    if (target instanceof Attr) {
      target = ((Attr) target).getOwnerElement();
    }
    while (target != null) {
      if (target instanceof Element) {
        addNamespaces(rv, (Element) target);
      }
      target = target.getParentNode();
    }
    //    Fallback in case no namespace was declared
    rv.declare(Namespace.create("", ""));
    return rv;
  }