Package org.dom4j

Examples of org.dom4j.Namespace


    public boolean hasNext() {
      return iter.hasNext();
    }

    public Object next() {
      Namespace ns = (Namespace) iter.next();
      String prefix = ns.getPrefix();
      String nsURI = ns.getURI();

      return factory.createNamespace(prefix, nsURI);
    }
View Full Code Here


   * @param prefix DOCUMENT ME!
   * @param uri    DOCUMENT ME!
   * @return DOCUMENT ME!
   */
  public Namespace addNamespace(String prefix, String uri) {
    Namespace namespace = createNamespace(prefix, uri);
    push(namespace);

    return namespace;
  }
View Full Code Here

  public Namespace pop(String prefix) {
    if (prefix == null) {
      prefix = "";
    }

    Namespace namespace = null;

    for (int i = namespaceStack.size() - 1; i >= 0; i--) {
      Namespace ns = (Namespace) namespaceStack.get(i);

      if (prefix.equals(ns.getPrefix())) {
        remove(i);
        namespace = ns;

        break;
      }
View Full Code Here

   *
   * @return DOCUMENT ME!
   */
  protected Namespace findDefaultNamespace() {
    for (int i = namespaceStack.size() - 1; i >= 0; i--) {
      Namespace namespace = (Namespace) namespaceStack.get(i);

      if (namespace != null) {
        String prefix = namespace.getPrefix();

        if ((prefix == null) || (namespace.getPrefix().length() == 0)) {
          return namespace;
        }
      }
    }

View Full Code Here

   *
   * @param index DOCUMENT ME!
   * @return DOCUMENT ME!
   */
  protected Namespace remove(int index) {
    Namespace namespace = (Namespace) namespaceStack.remove(index);
    namespaceCacheList.remove(index);
    defaultNamespace = null;
    currentNamespaceCache = null;

    return namespace;
View Full Code Here

    return null;
  }

  public String translateNamespacePrefixToUri(String prefix) {
    if ((prefix != null) && (prefix.length() > 0)) {
      Namespace ns = element.getNamespaceForPrefix(prefix);

      if (ns != null) {
        return ns.getURI();
      }
    }

    return null;
  }
View Full Code Here

  // SerializationContext interface
  // -------------------------------------------------------------------------

  public String getNamespacePrefix(String uri) {
    Namespace namespace = getNamespaceForURI(uri);

    return (namespace != null) ? namespace.getPrefix() : null;
  }
View Full Code Here

    // XXXX: no way to do this yet in dom4j so assume valid
    return true;
  }

  public String resolveNamespacePrefix(String prefix) {
    Namespace namespace = getNamespaceForPrefix(prefix);

    if (namespace != null) {
      return namespace.getURI();
    }

    return null;
  }
View Full Code Here

  public String getNamespacePrefix(String uri) {
    Element parentElement = getParent();

    if (parentElement != null) {
      Namespace namespace = parentElement.getNamespaceForURI(uri);

      if (namespace != null) {
        return namespace.getPrefix();
      }
    }

    return null;
  }
View Full Code Here

      return getNamespaceURI();
    } else {
      Element parentElement = getParent();

      if (parentElement != null) {
        Namespace namespace = parentElement
            .getNamespaceForPrefix(prefix);

        if (namespace != null) {
          return namespace.getURI();
        }
      }
    }

    return null;
View Full Code Here

TOP

Related Classes of org.dom4j.Namespace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.