Package nu.xom

Examples of nu.xom.Namespace


                }
               
                for (int i = position+1; i < nodes.size(); i++) {
                    Node next = nodes.get(i);
                    if ( !(next instanceof Namespace) ) break;
                    Namespace namespace = (Namespace) next;
                    String prefix = namespace.getPrefix();
                    String uri = namespace.getValue();
                   
                    if (uri.equals(inScope.getURI(prefix))) {
                        continue;
                    }
                    else if (exclusive) {
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

                }
               
                for (int i = position+1; i < nodes.size(); i++) {
                    Node next = nodes.get(i);
                    if ( !(next instanceof Namespace) ) break;
                    Namespace namespace = (Namespace) next;
                    String prefix = namespace.getPrefix();
                    String uri = namespace.getValue();
                   
                    if (uri.equals(inScope.getURI(prefix))) {
                        continue;
                    }
                    else if (exclusive) {
View Full Code Here

    }

    private void getInscopeNamespaces(Element original) {
        Nodes spaces = original.query("namespace::node()");
        for (int i = spaces.size() -1; i >= 0; i--) {
            Namespace space = (Namespace) spaces.get(i);
            System.out.println(space.getValue());           
        }
    }
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);
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(ns);
        }
        finally {
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);
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(ns);
        }
        finally {
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);
        try {
            Canonicalizer serializer = new Canonicalizer(out);
            serializer.write(ns);
        }
        finally {
View Full Code Here

       
        Element parent = new Element("Test", "http://www.example.org");
       
        Nodes result = parent.query("namespace::*");
        assertEquals(2, result.size());
        Namespace n1 = (Namespace) result.get(0);
        Namespace n2 = (Namespace) result.get(1);
        assertTrue(n1.getPrefix().equals("") || n2.getPrefix().equals(""));
        assertTrue(n1.getPrefix().equals("xml") || n2.getPrefix().equals("xml"));
        assertTrue(n1.getValue().equals("http://www.example.org")
          || n2.getValue().equals("http://www.example.org"));
        assertTrue(n1.getValue().equals(Namespace.XML_NAMESPACE)
          || n2.getValue().equals(Namespace.XML_NAMESPACE));
       
    }
View Full Code Here

        String xpath = "(/*/* | /*/*/namespace::*)\n";
        Nodes result = doc.query(xpath);
        assertEquals(4, result.size());
        Element parent = (Element) result.get(0);
        for (int i = 1; i < 4; i++) {
            Namespace namespace = (Namespace) result.get(i);
            assertEquals(parent, namespace.getParent());
        }
       
    }
View Full Code Here

       
    }
   
   
    public void testNamespaceEqualsItself() {
        Namespace ns = new Namespace("pre", "http://www.example.org", null);
        assertEquals(ns, ns);
    }
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.