Package nu.xom

Examples of nu.xom.Namespace


   
    public void testToXMLOnDefaultNamespace() {
    
        Element root = new Element("root", "http://www.example.org/");
        Nodes result = root.query("namespace::*[name() != 'xml']");
        Namespace namespace = (Namespace) result.get(0);
        assertEquals("xmlns=\"http://www.example.org/\"", namespace.toXML());
       
    }
View Full Code Here


   
    public void testDetachNamespaceNode() {
    
        Element root = new Element("pre:root", "http://www.example.org/");
        Nodes result = root.query("namespace::pre");
        Namespace namespace = (Namespace) result.get(0);
        namespace.detach();
        assertNull(namespace.getParent());
       
    }
View Full Code Here

   
    public void testRemoveNamespaceNode() {
    
        Element root = new Element("pre:root", "http://www.example.org/");
        Nodes result = root.query("namespace::pre");
        Namespace namespace = (Namespace) result.get(0);
        try {
            root.removeChild(namespace);
            fail("Namespaces are not children");
        }
        catch (NoSuchChildException success) {
View Full Code Here

   
    public void testGetParent() {
    
        Element root = new Element("pre:root", "http://www.example.org/");
        Nodes result = root.query("namespace::pre");
        Namespace namespace = (Namespace) result.get(0);
        assertEquals(root, namespace.getParent());
       
    }
View Full Code Here

   
    public void testToString() {
    
        Element root = new Element("pre:root", "http://www.example.org/");
        Nodes result = root.query("namespace::pre");
        Namespace namespace = (Namespace) result.get(0);
        assertEquals("[Namespace: xmlns:pre=\"http://www.example.org/\"]", namespace.toString());
       
    }
View Full Code Here

   
   
    public void testIllegalPrefix() {
    
        try {
            new Namespace("white space", "http://www.example.org", null);
            fail("Allowed prefix containing white space");
        }
        catch (IllegalNameException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

       
    }

   
    public void testEmptyStringPrefix() {
        Namespace ns = new Namespace("", "http://www.example.org", null);
        assertEquals("", ns.getPrefix());
    }
View Full Code Here

        assertEquals("", ns.getPrefix());
    }

   
    public void testNullPrefix() {
        Namespace ns = new Namespace(null, "http://www.example.org", null);
        assertEquals("", ns.getPrefix());
    }
View Full Code Here

   
    public void testIllegalURI() {
    
        try {
            new Namespace("pre", "http:// www.example.org", null);
            fail("Allowed URI containing white space");
        }
        catch (MalformedURIException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

       
    }

   
    public void testNullURI() {
        Namespace ns = new Namespace("", null, null);
        assertEquals("", ns.getValue());
    }
View Full Code Here

TOP

Related Classes of nu.xom.Namespace

Copyright © 2018 www.massapicom. 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.