Package nu.xom

Examples of nu.xom.Namespace


   
    public void testCantBindPrefixToEmptyURI() {
       
        try {
            new Namespace("pre", "", null);
            fail("Bound prefix to no namespace");
        }
        catch (NamespaceConflictException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here


   
    public void testCantBindXMLNS() {
       
        try {
            new Namespace("xmlns", "", null);
            fail("Bound xmlns prefix to no namespace");
        }
        catch (IllegalNameException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

   
    public void testCantBindXMLNSToDOMURI() {
       
        try {
            new Namespace("xmlns", "http://www.w3.org/2000/xmlns/", null);
            fail("Bound xmlns prefix to DOM namespace");
        }
        catch (IllegalNameException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

   
    public void testCantBindXMLPrefixToWrongURI() {
       
        try {
            new Namespace("xml", "http://www.w3.org/2000/xmlns/", null);
            fail("Bound xml prefix to DOM namespace");
        }
        catch (NamespaceConflictException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

    }

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

   
    public void testCanBindNonXMLPrefixToXMLURI() {
       
        try {
            new Namespace("pre", Namespace.XML_NAMESPACE, null);
            fail("Bound non-xml prefix to XML namespace");
        }
        catch (NamespaceConflictException success) {
            assertNotNull(success.getMessage());
        }
View Full Code Here

   
    public void testCanonicalizeNamespace() throws IOException {
    
        Element element = new Element("pre:foo", "http://www.example.org");
        Nodes namespaces = element.query("namespace::pre");
        Namespace ns = (Namespace) namespaces.get(0);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(ns);
        }
View Full Code Here

   
    public void testCanonicalizeDefaultNamespace() throws IOException {
    
        Element element = new Element("foo", "http://www.example.org");
        Nodes namespaces = element.query("namespace::*");
        Namespace ns = (Namespace) namespaces.get(0);
        if (ns.getPrefix().equals("xml")) ns = (Namespace) namespaces.get(1);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(ns);
        }
View Full Code Here

   
    public void testCanonicalizeXMLNamespace() throws IOException {
    
        Element element = new Element("foo");
        Nodes namespaces = element.query("namespace::*");
        Namespace ns = (Namespace) namespaces.get(0);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(ns);
        }
View Full Code Here

                if (!namespaces.isEmpty()) {
                    Iterator iterator = in.iterator();
                    while (iterator.hasNext()) {
                        Object o = iterator.next();
                        if (o instanceof Namespace) {
                            Namespace n = (Namespace) o;
                            if (element == n.getParent()) {
                                out.append(n);
                                iterator.remove();
                            }
                        }
                    }
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.