Examples of writeDefaultNamespace()


Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

        XMLStreamWriter streamWriter = StaxUtils.getXMLStreamWriter(payload.getResult());

        String namespace = "http://springframework.org/spring-ws";
        streamWriter.setDefaultNamespace(namespace);
        streamWriter.writeStartElement(namespace, "root");
        streamWriter.writeDefaultNamespace(namespace);
        streamWriter.writeStartElement(namespace, "child");
        streamWriter.writeCharacters("text");
        streamWriter.writeEndDocument();
        streamWriter.flush();
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

        XMLStreamWriter streamWriter = StaxUtils.getXMLStreamWriter(payload.getResult());

        String namespace = "http://springframework.org/spring-ws";
        streamWriter.setDefaultNamespace(namespace);
        streamWriter.writeStartElement(namespace, "root");
        streamWriter.writeDefaultNamespace(namespace);
        streamWriter.writeEmptyElement(namespace, "child");
        streamWriter.writeEndElement();
        streamWriter.flush();

        StringWriter writer = new StringWriter();
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

                    pfx = StaxUtils.getUniquePrefix(xmlWriter, name.getNamespaceURI(), false);
                }
                xmlWriter.setPrefix(pfx, name.getNamespaceURI());
                xmlWriter.writeStartElement(pfx, name.getLocalPart(), name.getNamespaceURI());
                if (StringUtils.isEmpty(pfx)) {
                    xmlWriter.writeDefaultNamespace(name.getNamespaceURI());
                } else {
                    xmlWriter.writeNamespace(pfx, name.getNamespaceURI());
                }
            } catch (XMLStreamException e) {
                throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_WRITE_EXC", BUNDLE), e);
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

            // Start document
            xsw.writeStartDocument();
            xsw.writeCharacters("\n");
            // component-task-result
            xsw.writeStartElement("component-task-result");
            xsw.writeDefaultNamespace("http://java.sun.com/xml/ns/jbi/management-message");
            xsw.writeCharacters("\n\t");
            // component-name
            xsw.writeStartElement("component-name");
            xsw.writeCharacters(msg.getComponent());
            xsw.writeEndElement();
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

                    pfx = StaxUtils.getUniquePrefix(xmlWriter, name.getNamespaceURI(), false);
                }
                xmlWriter.setPrefix(pfx, name.getNamespaceURI());
                xmlWriter.writeStartElement(pfx, name.getLocalPart(), name.getNamespaceURI());
                if (StringUtils.isEmpty(pfx)) {
                    xmlWriter.writeDefaultNamespace(name.getNamespaceURI());
                } else {
                    xmlWriter.writeNamespace(pfx, name.getNamespaceURI());
                }
            } catch (XMLStreamException e) {
                throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_WRITE_EXC", BUNDLE), e);
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

    public static void main(String[] args) {
        try {
            XMLStreamWriter xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);

            xmlStreamWriter.writeStartElement("Foo");
            xmlStreamWriter.writeDefaultNamespace("test.org");
            xmlStreamWriter.setDefaultNamespace("test.org");
            xmlStreamWriter.writeStartElement("Bar");

            xmlStreamWriter.writeEndElement();
            xmlStreamWriter.writeEndElement();
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

        xmlSecurityStreamWriter.writeStartElement("test1");
        stdXmlStreamWriter.writeStartElement("test1");

        xmlSecurityStreamWriter.writeDefaultNamespace("defaultns");
        stdXmlStreamWriter.writeDefaultNamespace("defaultns");

        xmlSecurityStreamWriter.writeNamespace("t2new", "test2ns");
        stdXmlStreamWriter.writeNamespace("t2new", "test2ns");

        xmlSecurityStreamWriter.writeStartElement("test2ns", "test2");
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

            writer.writeStartElement(element.getLocalName());
            // we need to check whether there's a default namespace visible at this point because
            // otherwise this element will go into that namespace unintentionally. So we check
            // whether there is a default NS visible and if so turn it off.
            if (writer.getNamespaceContext().getNamespaceURI("") != null) {
                writer.writeDefaultNamespace("");
            }
        }

        // add the namespaces
        serializeNamespaces(element, omOutput);
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

                        //writer.writeNamespace(prefix, nameSpaceName);
                        writer.setPrefix(prefix, nameSpaceName);
                    } else {
                        writer.writeStartElement(nameSpaceName, this
                                .getLocalName());
                        writer.writeDefaultNamespace(nameSpaceName);
                        writer.setDefaultNamespace(nameSpaceName);
                    }
                }
            } else {
                writer.writeStartElement(this.getLocalName());
View Full Code Here

Examples of javax.xml.stream.XMLStreamWriter.writeDefaultNamespace()

    // of an incorrect usage of XMLStreamWriter#writeStartElement(String).
    private static void testSerializeDeserializeWrapped(Object bean, Object expectedResult) throws Exception {
        StringWriter sw = new StringWriter();
        XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(sw);
        writer.writeStartElement("", "root", "urn:test");
        writer.writeDefaultNamespace("urn:test");
        ADBBeanUtil.serialize(bean, writer);
        writer.writeEndElement();
        writer.flush();
        OMElement omElement3 = OMXMLBuilderFactory.createOMBuilder(new StringReader(sw.toString())).getDocumentElement();
        assertBeanEquals(expectedResult, ADBBeanUtil.parse(bean.getClass(), omElement3.getFirstElement().getXMLStreamReader()));
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.