Package de.odysseus.staxon.xml

Examples of de.odysseus.staxon.xml.SimpleXMLStreamWriter.writeDefaultNamespace()


    StringWriter result = new StringWriter();
    XMLStreamWriter writer = new SimpleXMLStreamWriter(result, false);
    writer.setDefaultNamespace("http://some-namespace");
    writer.writeStartDocument();
    writer.writeStartElement("alice");
    writer.writeDefaultNamespace("http://some-namespace");
    writer.writeCharacters("bob");
    writer.writeEndElement();
    writer.writeEndDocument();
    writer.close();
    Assert.assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><alice xmlns=\"http://some-namespace\">bob</alice>", result.toString());
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.