Package org.apache.axiom.om

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


                OMElement endpointElem =
                        fac.createOMElement("endpoint", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                OMElement addressElem =
                        fac.createOMElement("address", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                addressElem.addAttribute(
                        fac.createOMAttribute("uri", nullNS, staticSubscription.getEndpointUrl()));
                endpointElem.addChild(addressElem);
                staticSubElem.addChild(endpointElem);
                if (staticSubscription.getExpires() != null) {
                    OMElement expiresElem =
                            fac.createOMElement("expires", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
View Full Code Here


    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", "urn:test", "");
        // Retrieve the namespace declaration generated by createOMElement
        OMNamespace ns = (OMNamespace)element.getAllDeclaredNamespaces().next();
        OMAttribute att = factory.createOMAttribute("test", null, "test");
        element.addAttribute(att);
        Iterator it = element.getAllDeclaredNamespaces();
        assertTrue(it.hasNext());
        assertEquals(ns, it.next());
        assertFalse(it.hasNext());
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement(new QName("test"));
        OMNamespace ns = factory.createOMNamespace("urn:ns", "p");
        OMAttribute att = factory.createOMAttribute("test", ns, "test");
        element.addAttribute(att);
        assertEquals(ns, element.findNamespace(ns.getNamespaceURI(), ns.getPrefix()));
        Iterator it = element.getAllDeclaredNamespaces();
        assertTrue(it.hasNext());
        assertEquals(ns, it.next());
View Full Code Here

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        OMAttribute attr1 = factory.createOMAttribute("attr", null, "value1");
        OMAttribute attr2 = factory.createOMAttribute("attr", null, "value2");
        OMAttribute attr = element.addAttribute(attr1);
        assertSame(attr1, attr);
        attr = element.addAttribute(attr2);
        assertSame(attr2, attr);
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        OMAttribute attr1 = factory.createOMAttribute("attr", null, "value1");
        OMAttribute attr2 = factory.createOMAttribute("attr", null, "value2");
        OMAttribute attr = element.addAttribute(attr1);
        assertSame(attr1, attr);
        attr = element.addAttribute(attr2);
        assertSame(attr2, attr);
        Iterator it = element.getAllAttributes();
View Full Code Here

public class OMAttributeTest extends TestCase {

    public void testNullLocalName() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        try {
            factory.createOMAttribute(null, null, null);
        } catch (IllegalArgumentException e) {
            return;
        }
        fail("Null localname was accepted!");
    }
View Full Code Here

    }

    public void testEmptyLocalName() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        try {
            factory.createOMAttribute("", null, null);
        } catch (IllegalArgumentException e) {
            return;
        }
        fail("Empty localname was accepted!");
    }
View Full Code Here

    }

    public void testWhitespaceLocalName() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        try {
            factory.createOMAttribute("    ", null, null);
        } catch (IllegalArgumentException e) {
            return;
        }
        fail("Whitespace localname was accepted!");
    }
View Full Code Here

    }

    public void testDefaultAttributeType() throws Exception {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("http://www.me.com", "axiom");
        OMAttribute at = factory.createOMAttribute("id", ns, "value");

        assertEquals(at.getAttributeType(), "CDATA");
    }

    private String addAttributeMethod1(String xmlString) throws Exception {
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement(new QName("test"));
        OMNamespace ns = factory.createOMNamespace("urn:ns", "p");
        element.declareNamespace(ns);
        OMAttribute att = factory.createOMAttribute("test", ns, "test");
        element.addAttribute(att);
        Iterator it = element.getAllDeclaredNamespaces();
        assertTrue(it.hasNext());
        assertEquals(ns, it.next());
        assertFalse(it.hasNext());
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.