Java Code Examples for org.w3c.dom.Node#isDefaultNamespace()
The following examples show how to use
org.w3c.dom.Node#isDefaultNamespace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ElementImpl.java From marklogic-contentpump with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override public boolean isDefaultNamespace(String namespaceURI) { String namespace = this.getNamespaceURI(); String prefix = this.getPrefix(); if (prefix == null || prefix.length() == 0) { if (namespaceURI == null) { return (namespace == namespaceURI); } return namespaceURI.equals(namespace); } if (this.hasAttributes()) { Attr attr = this.getAttributeNodeNS( "http://www.w3.org/2000/xmlns/", "xmlns"); if (attr != null) { String value = attr.getNodeValue(); if (namespaceURI == null) { return (namespace == value); } return namespaceURI.equals(value); } } Node ancestor = getParentNode(); if (ancestor != null) { short type = ancestor.getNodeType(); if (type == NodeKind.ELEM) { return ancestor.isDefaultNamespace(namespaceURI); } // otherwise, current node is root already } return false; }
Example 2
Source File: NodeImpl.java From marklogic-contentpump with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * <p> * Not supported for namespace declaration. Overrided by DocumentImpl and * ElementImpl * </p> */ public boolean isDefaultNamespace(String namespaceURI) { int type = getNodeType(); if (type == NodeKind.ATTR) { if (this instanceof AttrImpl == false) { // ns decl throw new UnsupportedOperationException(); } } Node p = getParentNode(); return p.isDefaultNamespace(namespaceURI); }
Example 3
Source File: LBCommonCartridgeFileParser.java From sakai with Educational Community License v2.0 | 4 votes |
private boolean enclosingDocumentContainsNamespaceDeclaration(Node node, String nameSpaceURI) { return node.isDefaultNamespace(nameSpaceURI); }
Example 4
Source File: CommonCartridgeFileParser.java From sakai with Educational Community License v2.0 | 4 votes |
private boolean enclosingDocumentContainsNamespaceDeclaration(Node node, String nameSpaceURI) { return node.isDefaultNamespace(CC_NAMESPACE_URI); }
Example 5
Source File: LBCommonCartridgeFileParser.java From sakai with Educational Community License v2.0 | 4 votes |
private boolean enclosingDocumentContainsNamespaceDeclaration(Node node, String nameSpaceURI) { return node.isDefaultNamespace(nameSpaceURI); }
Example 6
Source File: CommonCartridgeFileParser.java From sakai with Educational Community License v2.0 | 4 votes |
private boolean enclosingDocumentContainsNamespaceDeclaration(Node node, String nameSpaceURI) { return node.isDefaultNamespace(CC_NAMESPACE_URI); }