Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMCloneOptions


    public Node getLastChild() {
        return null;
    }

    public final Node cloneNode(boolean deep) {
        OMCloneOptions options = new OMCloneOptions();
        // This is not specified by the API, but it's compatible with versions before 1.2.14
        options.setPreserveModel(true);
        NodeImpl clone = clone(options, null, getNodeType() == Node.ATTRIBUTE_NODE ? true : deep, false);
        if (!(clone instanceof DocumentImpl)) {
            clone.setOwnerDocument(ownerDocument());
        }
        return clone;
View Full Code Here


    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMDataSource ds = new WrappedTextNodeOMDataSourceFromDataSource(new QName("wrapper"),
                new ByteArrayDataSource("test".getBytes("utf-8")), Charset.forName("utf-8"));
        OMSourcedElement element = factory.createOMElement(ds);
        OMCloneOptions options = new OMCloneOptions();
        options.setCopyOMDataSources(copyOMDataSources);
        OMElement clone = (OMElement)element.clone(options);
        if (copyOMDataSources) {
            assertTrue(clone instanceof OMSourcedElement);
            assertFalse(element.isExpanded());
        } else {
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMDataSource ds = new ByteArrayDataSource("<p:element xmlns:p='urn:ns'>test</p:element>".getBytes("utf-8"), "utf-8");
        OMSourcedElement element = factory.createOMElement(ds);
        OMCloneOptions options = new OMCloneOptions();
        options.setCopyOMDataSources(true);
        OMElement clone = (OMElement)element.clone(options);
        assertTrue(clone instanceof OMSourcedElement);
        assertFalse(element.isExpanded());
        OMNamespace expectedNS = factory.createOMNamespace("urn:ns", "p");
        assertEquals("element", element.getLocalName());
View Full Code Here

        addTestProperty("preserveModel", String.valueOf(preserveModel));
    }

    protected void runTest() throws Throwable {
        SOAPMessage message = (SOAPMessage)getBuilderForTestMessage(SOAP_MESSAGE).getDocument();
        OMCloneOptions options = new OMCloneOptions();
        options.setPreserveModel(preserveModel);
        OMInformationItem clone = message.clone(options);
        if (preserveModel) {
            assertTrue(clone instanceof SOAPMessage);
        } else {
            assertTrue(clone instanceof OMDocument);
View Full Code Here

    }

    protected void runTest() throws Throwable {
        SOAPMessage message = soapFactory.createSOAPMessage();
        message.addChild(soapFactory.getDefaultEnvelope());
        OMCloneOptions options = new OMCloneOptions();
        options.setPreserveModel(preserveModel);
        OMInformationItem clone = message.clone(options);
        if (preserveModel) {
            assertTrue(clone instanceof SOAPMessage);
        } else {
            assertTrue(clone instanceof OMDocument);
View Full Code Here

    }

    protected void runTest() throws Throwable {
        OMDocument original = metaFactory.createOMBuilder(metaFactory.getOMFactory(),
                TEST_PARSER_CONFIGURATION, new InputSource(file.getUrl().toString())).getDocument();
        OMDocument clone = (OMDocument)original.clone(new OMCloneOptions());
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        clone.serialize(baos);
        XMLAssertEx.assertXMLIdentical(file.getUrl(),
                new ByteArrayInputStream(baos.toByteArray()), false);
    }
View Full Code Here

            log.debug("cloneOMElement start");
            log.debug("  element string =" + getLocalName());
            log.debug(" isComplete = " + isComplete());
            log.debug("  builder = " + builder);
        }
        return (OMElement)clone(new OMCloneOptions());
    }
View Full Code Here

            return ns == null ? null : new QName(ns.getNamespaceURI(), qname.substring(idx+1), prefix);
        }
    }

    public OMElement cloneOMElement() {
        return (OMElement)clone(new OMCloneOptions());
    }
View Full Code Here

        return list.iterator();
    }

    public OMElement cloneOMElement() {
        return (OMElement)clone(new OMCloneOptions());
    }
View Full Code Here

    public NamedNodeMap getAttributes() {
        return null; // overridden in ElementImpl
    }

    public final Node cloneNode(boolean deep) {
        OMCloneOptions options = new OMCloneOptions();
        // This is not specified by the API, but it's compatible with versions before 1.2.14
        options.setPreserveModel(true);
        NodeImpl clone = clone(options, null, getNodeType() == Node.ATTRIBUTE_NODE ? true : deep, false);
        if (!(clone instanceof DocumentImpl)) {
            clone.coreSetOwnerDocument(ownerDocument());
        }
        return clone;
View Full Code Here

TOP

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

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.