Package com.ctc.wstx.util

Examples of com.ctc.wstx.util.BijectiveNsMap.addMapping()


    extends TestCase
{
    public void testMaskingForFindPrefix() throws Exception
    {
        BijectiveNsMap nsMap = BijectiveNsMap.createEmpty();
        nsMap.addMapping("ns", "abc");
        assertEquals("ns", nsMap.findPrefixByUri("abc"));
        // and then let's mask it
        nsMap = nsMap.createChild();
        nsMap.addMapping("ns", "xyz");
        String uri = nsMap.findPrefixByUri("abc");
View Full Code Here


        BijectiveNsMap nsMap = BijectiveNsMap.createEmpty();
        nsMap.addMapping("ns", "abc");
        assertEquals("ns", nsMap.findPrefixByUri("abc"));
        // and then let's mask it
        nsMap = nsMap.createChild();
        nsMap.addMapping("ns", "xyz");
        String uri = nsMap.findPrefixByUri("abc");
        if (uri != null) {
            fail("Expected null for masked prefix, got '"+uri+"'");
        }
    }
View Full Code Here

    }

    public void testMaskingForGetBoundPrefixes() throws Exception
    {
        BijectiveNsMap nsMap = BijectiveNsMap.createEmpty();
        nsMap.addMapping("ns", "abc");
        List<?> l = nsMap.getPrefixesBoundToUri("abc", null);
        assertEquals(1, l.size());
        assertEquals("ns", l.iterator().next());

        // and then let's mask it
View Full Code Here

        assertEquals(1, l.size());
        assertEquals("ns", l.iterator().next());

        // and then let's mask it
        nsMap = nsMap.createChild();
        nsMap.addMapping("ns", "xyz");
        assertEquals(0, nsMap.getPrefixesBoundToUri("abc", new ArrayList<String>()).size());

        // and finally, let's re-bind it
        nsMap = nsMap.createChild();
        nsMap.addMapping("ns", "abc");
View Full Code Here

        nsMap.addMapping("ns", "xyz");
        assertEquals(0, nsMap.getPrefixesBoundToUri("abc", new ArrayList<String>()).size());

        // and finally, let's re-bind it
        nsMap = nsMap.createChild();
        nsMap.addMapping("ns", "abc");
        assertEquals(1, nsMap.getPrefixesBoundToUri("abc", null).size());

        // and add another similar binding
        nsMap.addMapping("ns2", "abc");
        assertEquals(2, nsMap.getPrefixesBoundToUri("abc", null).size());
View Full Code Here

        nsMap = nsMap.createChild();
        nsMap.addMapping("ns", "abc");
        assertEquals(1, nsMap.getPrefixesBoundToUri("abc", null).size());

        // and add another similar binding
        nsMap.addMapping("ns2", "abc");
        assertEquals(2, nsMap.getPrefixesBoundToUri("abc", null).size());
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.