public class XOPRoundtripTest extends TestCase {
public void test() {
OMFactory factory = OMAbstractFactory.getOMFactory();
DataHandler dh = new DataHandler(new TestDataSource('x', Runtime.getRuntime().maxMemory()));
OMElement element1 = factory.createOMElement(new QName("test"));
element1.addChild(factory.createOMText(dh, true));
XMLStreamReader originalReader = element1.getXMLStreamReader();
XOPEncodingStreamReader encodedReader = new XOPEncodingStreamReader(originalReader,
ContentIDGenerator.DEFAULT, OptimizationPolicy.DEFAULT);
XMLStreamReader decodedReader = new XOPDecodingStreamReader(encodedReader, encodedReader);
OMElement element2 = OMXMLBuilderFactory.createStAXOMBuilder(decodedReader).getDocumentElement();