List of usage examples for org.dom4j Namespace NO_NAMESPACE
Namespace NO_NAMESPACE
To view the source code for org.dom4j Namespace NO_NAMESPACE.
Click Source Link
From source file:org.orbeon.oxf.processor.tamino.dom4j.TDOM4JXMLOutputter.java
License:Open Source License
/** ** Gets all the declared namespaces starting at the given element and accumulates the detected namespaces ** within the given namespace stack. The given namespace stack is also returned as the result. ** Please note, that this method has been added for the purpose that not always all given namespaces ** are serialized if they are already given for an ancestor. **///from www. j ava 2 s . com private TDOM4JNamespaceStack getParentNamespaces(Element element, TDOM4JNamespaceStack namespaces) { if (element == null) return namespaces; if (element.getParent() != null) namespaces = getParentNamespaces(element.getParent(), namespaces); Namespace ns = element.getNamespace(); // Add namespace decl only if it's not the XML namespace and it's // not the NO_NAMESPACE with the prefix "" not yet mapped // (we do output xmlns="" if the "" prefix was already used and we // need to reclaim it for the NO_NAMESPACE) if (ns != Namespace.XML_NAMESPACE && !(ns == Namespace.NO_NAMESPACE && namespaces.getURI("") == null)) { String prefix = ns.getPrefix(); String uri = namespaces.getURI(prefix); // Put a new namespace declaratation into the namespace stack if (!ns.getURI().equals(uri)) { namespaces.push(ns); } } // Add additional namespace declarations if not given yet List additionalNamespaces = element.additionalNamespaces(); if (additionalNamespaces != null) { for (int i = 0; i < additionalNamespaces.size(); i++) { Namespace additional = (Namespace) additionalNamespaces.get(i); String prefix = additional.getPrefix(); String uri = namespaces.getURI(prefix); if (!additional.getURI().equals(uri)) namespaces.push(additional); } } return namespaces; }
From source file:org.orbeon.oxf.xforms.itemset.Itemset.java
License:Open Source License
public static String getAttributeName(QName key) { final String attributeName; if (key.getNamespace().equals(Namespace.NO_NAMESPACE)) { attributeName = key.getName();//from ww w . j ava 2 s. c om } else if (key.getNamespace().equals(XFormsConstants.XXFORMS_NAMESPACE)) { attributeName = "xxforms-" + key.getName(); } else { // Other namespaces are not allowed in the first place throw new IllegalStateException("Invalid attribute on item: " + key.getName()); } return attributeName; }
From source file:org.selenium.runner.dao.NameSpaceCleaner.java
License:Apache License
/** * {@inheritDoc}//from www. j a v a 2 s. c o m */ public void visit(Document document) { ((DefaultElement) document.getRootElement()).setNamespace(Namespace.NO_NAMESPACE); document.getRootElement().additionalNamespaces().clear(); }
From source file:org.selenium.runner.dao.NameSpaceCleaner.java
License:Apache License
/** * {@inheritDoc}//from w w w.j a v a2s. c o m */ public void visit(Element node) { if (node instanceof DefaultElement) { ((DefaultElement) node).setNamespace(Namespace.NO_NAMESPACE); } }