Code example for NamespaceContext

Methods: getNamespaceURI

0
     */ 
    @Test
    public void findsDefaultNamespaces() throws Exception {
        final NamespaceContext ctx = new XPathContext();
        MatcherAssert.assertThat( 
            ctx.getNamespaceURI("xhtml"),
            Matchers.equalTo("http://www.w3.org/1999/xhtml") 
        ); 
        MatcherAssert.assertThat( 
            ctx.getNamespaceURI("xsl"),
            Matchers.equalTo("http://www.w3.org/1999/XSL/Transform") 
        ); 
        MatcherAssert.assertThat( 
            ctx.getNamespaceURI("xsi"),
            Matchers.equalTo("http://www.w3.org/2001/XMLSchema-instance") 
        ); 
        MatcherAssert.assertThat( 
            ctx.getNamespaceURI("xs"),
            Matchers.equalTo("http://www.w3.org/2001/XMLSchema") 
        ); 
        MatcherAssert.assertThat( 
            ctx.getNamespaceURI(XMLConstants.XML_NS_PREFIX),
            Matchers.equalTo(XMLConstants.XML_NS_URI)
        ); 
        MatcherAssert.assertThat( 
            ctx.getNamespaceURI(XMLConstants.XMLNS_ATTRIBUTE),
            Matchers.equalTo(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)
        ); 
    } 
 
    /** 
Connect your IDE to all the code out there  Get Codota for Java