Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMFactory.createOMElement()


        // Create OMSE with an unknown prefix
        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", null);
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument2), "library", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);

        // Test getting the local name and namespace URI. This should used not result in expansion
        assertTrue(element.getLocalName().equals("library"));
View Full Code Here


        // Create OMSE with an unknown prefix
        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", null);
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument2), "library", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);

        // Test getting the local name and namespace URI. This should used not result in expansion
        assertTrue(element.getLocalName().equals("library"));
        assertTrue(element.getNamespace().getNamespaceURI().equals(
View Full Code Here

    protected void runTest() throws Throwable {
        String NSURI = "http://testns";
        String NSURI_UPPER = "HTTP://TESTNS";

        OMFactory fac = metaFactory.getOMFactory();
        OMElement el = fac.createOMElement("foo", null);
        el.declareNamespace(NSURI, "p");
        assertNull(el.findNamespace(NSURI_UPPER, "p"));
    }
}
View Full Code Here

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("", "");
        OMSourcedElement element = factory.createOMElement(new CharArrayDataSource(
                "<element>content</element>".toCharArray()), "element", ns);
        // This actually returns the "declared" namespace because the sourced element is not
        // expanded yet. Nevertheless the value should have been normalized to null.
        assertNull(element.getNamespace());
        // Now expand the element and check getNamespace() again
View Full Code Here

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMSourcedElement omse = factory.createOMElement(new ByteArrayDataSource("<sourcedelement/>".getBytes("utf-8"), "utf-8"));
        OMElement parent = factory.createOMElement(new QName("parent"));
        parent.addChild(omse);
        // Cause expansion of the sourced element without building it completely
        omse.getLocalName();
        assertTrue(omse.isExpanded());
View Full Code Here

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMSourcedElement omse = factory.createOMElement(new ByteArrayDataSource("<sourcedelement/>".getBytes("utf-8"), "utf-8"));
        OMElement parent = factory.createOMElement(new QName("parent"));
        parent.addChild(omse);
        // Cause expansion of the sourced element without building it completely
        omse.getLocalName();
        assertTrue(omse.isExpanded());
        assertFalse(omse.isComplete());
View Full Code Here

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        element.addAttribute("attr", "value", null);
        assertNull(element.getAttributeValue(new QName("urn:ns", "attr2")));
    }
}
View Full Code Here

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement(new QName("test"));
        OMNamespace ns = element.declareNamespace("urn:ns", "");
        assertEquals("urn:ns", ns.getNamespaceURI());
        assertNotNull(ns.getPrefix());
        assertTrue(ns.getPrefix().length() > 0);
        Iterator it = element.getAllDeclaredNamespaces();
View Full Code Here

        // Create OMSE with a DUMMYPREFIX prefix even though the underlying element uses the default prefix
        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "DUMMYPREFIX");
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument), "DUMMYNAME", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);

        // Test getting the namespace, localpart and prefix.  This should used not result in expansion
        assertTrue(element.getLocalName().equals("DUMMYNAME"));
View Full Code Here

        // Create OMSE with a DUMMYPREFIX prefix even though the underlying element uses the default prefix
        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "DUMMYPREFIX");
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument), "DUMMYNAME", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);

        // Test getting the namespace, localpart and prefix.  This should used not result in expansion
        assertTrue(element.getLocalName().equals("DUMMYNAME"));
        assertTrue(element.getNamespace().getNamespaceURI().equals("http://DUMMYNS"));
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.