Examples of ElementWriter


Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        try {
            writer.setNamespaceContext(namespaceContext);
        } catch (XMLStreamException e) {
            throw new RuntimeException(e);
        }
        return new ElementWriter(writer);
    }
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        return writeObjectToElement(type, bean, getContext());
    }

    protected Element writeObjectToElement(AegisType type, Object bean, Context context) {
        Element element = createElement("urn:Bean", "root", "b");
        ElementWriter writer = getElementWriter(element, new MapNamespaceContext());
        type.writeObject(bean, writer, getContext());
        writer.close();
        return element;
    }
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        Element element = createElement("urn:Bean", "root", "b");
        MapNamespaceContext namespaces = new MapNamespaceContext();
        for (Map.Entry<String, String> entry : getNamespaces().entrySet()) {
            namespaces.addNamespace(entry.getKey(), entry.getValue());
        }
        ElementWriter rootWriter = getElementWriter(element, namespaces);
        Context context = getContext();

        // get AegisType based on the object instance
        assertNotNull("type is null", type);

        // write the ref
        SoapRefType soapRefType = new SoapRefType(type);
        MessageWriter cwriter = rootWriter.getElementWriter(soapRefType.getSchemaType());
        soapRefType.writeObject(instance, cwriter, context);
        cwriter.close();

        // write the trailing blocks (referenced objects)
        trailingBlocks.writeBlocks(rootWriter, context);
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        reader.getXMLStreamReader().close();

        // Test writing

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ElementWriter writer = new ElementWriter(bos, "root", "urn:Bean");
        type.writeObject(bean, writer, getContext());
        writer.close();
        writer.flush();

        bos.close();

        Document doc = DOMUtils.readXml(new ByteArrayInputStream(bos.toByteArray()));
        Element element = doc.getDocumentElement();
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        reader.getXMLStreamReader().close();

        // Test writing

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ElementWriter writer = new ElementWriter(bos, "root", "urn:Bean");
        type.writeObject(bean, writer, getContext());
        writer.close();
        writer.flush();

        bos.close();

        Document doc = DOMUtils.readXml(new ByteArrayInputStream(bos.toByteArray()));
        Element element = doc.getDocumentElement();
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        try {
            writer.setNamespaceContext(namespaceContext);
        } catch (XMLStreamException e) {
            throw new RuntimeException(e);
        }
        return new ElementWriter(writer);
    }
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        return writeObjectToElement(type, bean, getContext());
    }

    protected Element writeObjectToElement(AegisType type, Object bean, Context context) {
        Element element = createElement("urn:Bean", "root", "b");
        ElementWriter writer = getElementWriter(element, new MapNamespaceContext());
        type.writeObject(bean, writer, getContext());
        writer.close();
        return element;
    }
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        }
       
        type = TypeUtil.getWriteType(context, obj, type);
       
        try {
            ElementWriter writer = new ElementWriter(output);
            MessageWriter w2 = writer.getElementWriter(part.getConcreteName());
            if (type.isNillable() && type.isWriteOuter() && obj == null) {
                w2.writeXsiNil();
                return;
            }
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        reader.getXMLStreamReader().close();

        // Test writing

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ElementWriter writer = new ElementWriter(bos, "root", "urn:Bean");
        type.writeObject(bean, writer, getContext());
        writer.close();
        writer.flush();

        bos.close();
       
        StaxBuilder builder = new StaxBuilder();
        Document doc = builder.build(new ByteArrayInputStream(bos.toByteArray()));
View Full Code Here

Examples of org.apache.cxf.aegis.xml.stax.ElementWriter

        MapNamespaceContext namespaces = new MapNamespaceContext();
        // we should not add the out namespace here, as it is not a part of root element
        /*for (Map.Entry<String, String> entry : getNamespaces().entrySet()) {
            namespaces.addNamespace(entry.getKey(), entry.getValue());
        }*/
        ElementWriter rootWriter = getElementWriter(element, namespaces);
        Context context = getContext();

        // get AegisType based on the object instance
        assertNotNull("type is null", type);

        // write the ref
        SoapRefType soapRefType = new SoapRefType(type);
        MessageWriter cwriter = rootWriter.getElementWriter(soapRefType.getSchemaType());
        soapRefType.writeObject(instance, cwriter, context);
        cwriter.close();

        // write the trailing blocks (referenced objects)
        trailingBlocks.writeBlocks(rootWriter, context);
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.