/** * @inheritDoc */ public String lookupNamespaceURI(String prefix) { return dom.lookupNamespaceURI(prefix); }
@Override public String lookupNamespaceURI(String prefix) { return original_.lookupNamespaceURI(prefix); }
public String lookupNamespaceURI(String prefix) { return this.doc.lookupNamespaceURI(prefix); }
@Override public String lookupNamespaceURI(String prefix) { return original_.lookupNamespaceURI(prefix); }
@Override public String lookupNamespaceURI(String prefix) { return document.lookupNamespaceURI(prefix); }
public String lookupNamespaceURI(String prefix) { return document.lookupNamespaceURI(prefix); }
@Override public String getNamespaceURI(String prefix) { if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) { return this.document.lookupNamespaceURI(null); } else { return this.document.lookupNamespaceURI(prefix); } }
public String getNamespaceURI(String prefix) { if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) { return document.lookupNamespaceURI(null); } else { return document.lookupNamespaceURI(prefix); } }
@Override public String getNamespaceURI(String prefix) { if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) { return this.document.lookupNamespaceURI(null); } else { return this.document.lookupNamespaceURI(prefix); } }
@Override public String getNamespaceURI(String prefix) { if (usedPprefixToNamespaceMap != null) { String ns = usedPprefixToNamespaceMap.get(prefix); if (ns != null) { return ns; } } return applyToDocument.lookupNamespaceURI(prefix); }
public String getNamespaceURI(String prefix) { return targetNode.getOwnerDocument().lookupNamespaceURI(prefix); }
public String getNamespaceURI(String prefix) { if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) { return sourceDocument.lookupNamespaceURI(null); } if (userDefinedNamespaces != null && userDefinedNamespaces.containsKey(prefix)) { return userDefinedNamespaces.get(prefix); } else { return sourceDocument.lookupNamespaceURI(prefix); } }
@Override public String getNamespaceURI(String prefix) { if (prefix == null || prefix.equals("")) { return document.getDocumentElement().getNamespaceURI(); } else { return document.lookupNamespaceURI(prefix); } }
private static Element createElement(final Document document, final String elementName) { final String prefix = getPrefixOfQName(elementName);// .replaceAll("(:.*)|([^:])*", ""); final String namespaceURI = prefix.isEmpty() ? null : document.lookupNamespaceURI(prefix); final Element element; if (namespaceURI == null) { element = document.createElement(elementName); } else { element = document.createElementNS(namespaceURI, elementName); } return element; }
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); Document doc = factory.newDocumentBuilder().parse(new InputSource(new StringReader(validXML))); String namespace = doc.lookupNamespaceURI("oai-identifier");
protected void runTest() throws Throwable { Document document = dbf.newDocumentBuilder().newDocument(); assertNull(document.lookupNamespaceURI("p")); } }
private static Element createElement(final Document document, final String elementName) { final String prefix = getPrefixOfQName(elementName);// .replaceAll("(:.*)|([^:])*", ""); final String namespaceURI = prefix.isEmpty() ? null : document.lookupNamespaceURI(prefix); final Element element; if (namespaceURI == null) { element = document.createElement(elementName); } else { element = document.createElementNS(namespaceURI, elementName); } return element; }
protected void runTest() throws Throwable { Document document = dbf.newDocumentBuilder().newDocument(); Element documentElement = document.createElementNS("urn:test", "ns:root"); documentElement.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:ns", "urn:test"); document.appendChild(documentElement); // Note: this part is also tested by the W3C test suite (see nodelookupnamespaceuri02) assertEquals("urn:test", document.lookupNamespaceURI("ns")); // The following assertion is important to check that there is no infinite recursion // (Document delegates the lookup to its document element, but the document element must // not delegate to its parent if no matching declaration is found). // This is not tested by the W3C test suite. assertNull(document.lookupNamespaceURI("p")); } }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; String namespaceURI; String nullPrefix = null; doc = (Document) load("barfoo_nodefaultns", false); namespaceURI = doc.lookupNamespaceURI(nullPrefix); assertNull("nodelookupnamespaceuri01", namespaceURI); } /**
@Override public String getNamespaceURI(String prefix){ Document document = getDocument(); if((XMLConstants.DEFAULT_NS_PREFIX).equals(prefix)){ return document.lookupNamespaceURI(null); } // End if // XXX if(("test").equals(prefix)){ return "http://localhost/test"; } return document.lookupNamespaceURI(prefix); }