Code example for NamespaceContext

Methods: getNamespaceURI

0
				namespaceContext.getNamespaceURI("attr"));
 
		OMElement child = root.getFirstElement();
		assertEquals(1, getNamespaceCount(child));
		namespaceContext = child.getNamespaceContext(false);
		assertEquals("http://www.springframework.org/spring-ws", namespaceContext.getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX));
		assertEquals("http://www.springframework.org/spring-ws/child", namespaceContext.getNamespaceURI("prefix"));
	} 
 
	private int getNamespaceCount(OMElement element) {
		int i = 0;
		Iterator namespaces = element.getAllDeclaredNamespaces();
		while (namespaces.hasNext()) {
			namespaces.next();
			i++;
		} 
		return i;
	} 
 
} 
Experience pair programming with AI  Get Codota for Java