Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMNamespace


    public TestGetNamespace(OMMetaFactory metaFactory, OMSourcedElementVariant variant, QName qname) {
        super(metaFactory, variant, qname);
    }

    protected void runTest(OMSourcedElement element) throws Throwable {
        OMNamespace ns = element.getNamespace();
        if (qname.getNamespaceURI().length() == 0) {
            assertNull(ns);
        } else {
            assertEquals(qname.getNamespaceURI(), ns.getNamespaceURI());
            assertEquals(qname.getPrefix(), ns.getPrefix());
        }
        if (variant.isNamespaceURIRequiresExpansion() || variant.isPrefixRequiresExpansion(qname)) {
            assertTrue(element.isExpanded());
        } else {
            assertFalse(element.isExpanded());
View Full Code Here


    protected void runTest() throws Throwable {
        OMFactory f = metaFactory.getOMFactory();

        // 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);
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement parent = factory.createOMElement("parent", null);
        OMElement child = factory.createOMElement("child", null, parent);
        OMNamespace ns = parent.declareNamespace("urn:test", "p");
        child.undeclarePrefix("p");
        assertEquals(ns, parent.findNamespaceURI("p"));
        assertNull(child.findNamespaceURI("p"));
    }
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory f = metaFactory.getOMFactory();

        // 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://www.sosnoski.com/uwjws/library", "");
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument2), "library", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);
View Full Code Here

    }

    protected void runTest() throws Throwable {
        // Build a root element and child OMSE
        OMFactory f = metaFactory.getOMFactory();
        OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "");
        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        OMElement child = f.createOMElement(new TestDataSource(testDocument), "library", ns);
        OMElement root = f.createOMElement("root", rootNS);
       
        // Trigger expansion of the child OMSE
        // This will cause the child to be partially parsed (i.e. incomplete)
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory f = metaFactory.getOMFactory();

        // 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("", "");
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument3), "library", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);
View Full Code Here

        public String getPrefix() {
            if (!isExpanded()) {
                forceExpand();
            }
            OMNamespace actualNS = getNamespace();
            return actualNS == null ? "" : actualNS.getPrefix();
        }
View Full Code Here

       
        public boolean equals(Object obj) {
            if (!(obj instanceof OMNamespace)) {
                return false;
            }
            OMNamespace other = (OMNamespace)obj;
            String otherPrefix = other.getPrefix();
            String thisPrefix = getPrefix();
            return (uri.equals(other.getNamespaceURI()) &&
                    (thisPrefix == null ? otherPrefix == null :
                            thisPrefix.equals(otherPrefix)));
        }
View Full Code Here

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("urn:test", "p");
        OMElement parent = factory.createOMElement("parent", ns);
        OMElement child = factory.createOMElement("child", null, parent);
        child.setNamespace(ns);
        assertEquals(new QName("urn:test", "child"), child.getQName());
        assertEquals(ns, child.getNamespace());
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory f = metaFactory.getOMFactory();

        // 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(testDocument), "library", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMNamespace

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.