Package org.apache.axiom.c14n.omwrapper.interfaces

Examples of org.apache.axiom.c14n.omwrapper.interfaces.Element


        dp = new DataParser("/sample1.xml");
        dp.init();
        // get e5
        OMElement e5 = dp.omDocEle.getFirstChildWithName(new QName("http://example.org", "e5"));
        // get the wrapped element of e5
        Element e = (Element) dp.fac.getNode(e5);
        nnm = e.getAttributes();
    }
View Full Code Here


        dp = new DataParser("/sample1.xml");
        dp.init();
        // get e5
        OMElement e5 = dp.omDocEle.getFirstChildWithName(new QName("http://example.org","e5"));
        // get the wrapped element of e5
        Element e = (Element)dp.fac.getNode(e5);
        nnm = e.getAttributes();

    }
View Full Code Here

    public void testOwnerElement() {
        // get e5
        OMElement e5 = dp.omDocEle.getFirstChildWithName(new QName("http://example.org","e5"));
        // get the wrapped element of e5
        Element e = (Element)dp.fac.getNode(e5);
        // attr is a:attr="out"
        attr = (Attr)e.getAttributes().item(0);
        // the getOwnerElement() should provide a reference to the same object pointed by reference e
        assertEquals(e, attr.getOwnerElement());
    }
View Full Code Here

        dp.init();
    }

    public void testHasAttributes() {
        // first child of docEle is of Text type. So we get the next sibling of that,i.e. e1
        Element e = (Element) dp.docEle.getFirstChild().getNextSibling();
        // e1 has one attribute which is in fact a namespace declaration
        assertEquals(true, e.hasAttributes());
        // get e2
        e = (Element) e.getNextSibling().getNextSibling();
        // e2 has the default namespace declaration
        assertEquals(true, e.hasAttributes());
        // get e2child
        e = (Element) e.getFirstChild();
        // e2child gets the default namespace from parent, but it's not an attribute of it
        assertEquals(false, e.hasAttributes());
    }
View Full Code Here

    public void testGetNamespaceURI() {
        // <e2   xmlns="http://www.blankns.com" ><e2child>I've no attributes</e2child></e2>
        OMElement e2 = dp.omDocEle.getFirstChildWithName(new QName("http://www.blankns.com", "e2"));
        // get the wrapped element
        Element e = (Element) dp.fac.getNode(e2);
        assertEquals("http://www.blankns.com", e.getNamespaceURI());
        // <e2child>I've no attributes</e2child>
        e = (Element) e.getFirstChild();
        // e2child inherits the default namespace of e2
        assertEquals("http://www.blankns.com", e.getNamespaceURI());

        // <e3   name =    "elem3" id="elem3"/>
        OMElement e3 = dp.omDocEle.getFirstChildWithName(new QName("e3"));
        // get the wrapped element
        e = (Element) dp.fac.getNode(e3);
        assertNull("Namespace URI of e3 is null", e.getNamespaceURI());
    }
View Full Code Here

    public void testGetPrefix() {
        // <e2   xmlns="http://www.blankns.com" ><e2child>I've no attributes</e2child></e2>
        OMElement e2 = dp.omDocEle.getFirstChildWithName(new QName("http://www.blankns.com", "e2"));
        // get the wrapped element
        Element e = (Element) dp.fac.getNode(e2);
        assertNull("prefix of e2 is null", e.getPrefix());
        // <a:e1 xmlns:a="http://www.nonamespace.com"  />
        e = (Element) e.getPreviousSibling().getPreviousSibling();
        assertEquals("a", e.getPrefix());
    }
View Full Code Here

    public void testGetNodeName() {
        // <a:e1 xmlns:a="http://www.nonamespace.com"  />
        OMElement e1 = dp.omDocEle.getFirstElement();
        // get the wrapped element
        Element e = (Element) dp.fac.getNode(e1);
        assertEquals("a:e1", e.getNodeName());
        // <e2   xmlns="http://www.blankns.com" ><e2child>I've no attributes</e2child></e2>
        e = (Element) e.getNextSibling().getNextSibling();
        assertEquals("e2", e.getNodeName());
    }
View Full Code Here

        e = (Element) e.getNextSibling().getNextSibling();
        assertEquals("e2", e.getNodeName());
    }

    public void testGetFirstChild() {
        Element e = (Element) dp.fac.getNode(dp.omDocEle);
        // first child of root element represents the newline character so it's a text node
        assertEquals(Node.TEXT_NODE, e.getFirstChild().getNodeType());
    }
View Full Code Here

    // in DOM it would be just "\n". Taking the next sibling of that would be
    // <don't><process><this>:) and taking the next sibling of that would be "\n"
    // so Axiom put all these three into one OMText node. This wasn't a issue yet :)
    // but thought to mention it for clarity.
    public void testGetNextSibling() {
        Element e = (Element) dp.fac.getNode(dp.omDocEle);
        // first child of root element represents the newline character so it's a text node
        // the getNextSibling() of that should return element e1
        assertEquals(Node.ELEMENT_NODE, (e = (Element)e.getFirstChild().getNextSibling()).getNodeType());
        assertEquals("a:e1", e.getNodeName());
    }
View Full Code Here

        assertEquals("a:e1", e.getNodeName());
    }

    public void testGetPreviousSibling() {
        // <a:e1 xmlns:a="http://www.nonamespace.com"  />
        Element e = (Element) dp.fac.getNode(dp.omDocEle.getFirstElement());
        // this n is a text node representing the newline character
        Node n = e.getPreviousSibling();
        assertEquals(Node.TEXT_NODE, n.getNodeType());
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.c14n.omwrapper.interfaces.Element

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.