Search in sources :

Example 46 with XmlObject

use of org.apache.xmlbeans.XmlObject in project hackpad by dropbox.

the class XML method removeToken.

/**
     *
     * @param curs
     */
protected void removeToken(XmlCursor curs) {
    XmlObject xo = XmlObject.Factory.newInstance();
    // Don't delete anything move to another document so it gets orphaned nicely.
    XmlCursor tmpCurs = xo.newCursor();
    tmpCurs.toFirstContentToken();
    curs.moveXml(tmpCurs);
    tmpCurs.dispose();
}
Also used : XmlObject(org.apache.xmlbeans.XmlObject) XmlCursor(org.apache.xmlbeans.XmlCursor)

Example 47 with XmlObject

use of org.apache.xmlbeans.XmlObject in project camel by apache.

the class XmlBeansConverterTest method toXmlObjectFromByteArray.

@Test
public void toXmlObjectFromByteArray() throws Exception {
    XmlObject result = XmlBeansConverter.toXmlObject(PAYLOAD.getBytes(), new DefaultExchange(new DefaultCamelContext()));
    assertBuyStocks(result);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) XmlObject(org.apache.xmlbeans.XmlObject) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 48 with XmlObject

use of org.apache.xmlbeans.XmlObject in project camel by apache.

the class XmlBeansConverterTest method toXmlObjectFromNode.

@Test
public void toXmlObjectFromNode() throws Exception {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setIgnoringElementContentWhitespace(true);
    factory.setIgnoringComments(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse(new InputSource(new StringReader(PAYLOAD)));
    XmlObject result = XmlBeansConverter.toXmlObject(document, new DefaultExchange(new DefaultCamelContext()));
    assertBuyStocks(result);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) InputSource(org.xml.sax.InputSource) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) StringReader(java.io.StringReader) XmlObject(org.apache.xmlbeans.XmlObject) BuyStocksDocument(samples.services.xsd.BuyStocksDocument) Document(org.w3c.dom.Document) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 49 with XmlObject

use of org.apache.xmlbeans.XmlObject in project camel by apache.

the class XmlBeansConverterTest method toXmlObjectFromXMLStreamReader.

@Test
public void toXmlObjectFromXMLStreamReader() throws Exception {
    XmlObject result = XmlBeansConverter.toXmlObject(new XMLStreamReader(new ByteArrayInputStream(PAYLOAD.getBytes()), false), new DefaultExchange(new DefaultCamelContext()));
    assertBuyStocks(result);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) XMLStreamReader(org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) XmlObject(org.apache.xmlbeans.XmlObject) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 50 with XmlObject

use of org.apache.xmlbeans.XmlObject in project camel by apache.

the class XmlBeansConverterTest method toXmlObjectFromString.

@Test
public void toXmlObjectFromString() throws Exception {
    XmlObject result = XmlBeansConverter.toXmlObject(PAYLOAD, new DefaultExchange(new DefaultCamelContext()));
    assertBuyStocks(result);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) XmlObject(org.apache.xmlbeans.XmlObject) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Aggregations

XmlObject (org.apache.xmlbeans.XmlObject)102 XmlCursor (org.apache.xmlbeans.XmlCursor)49 XmlException (org.apache.xmlbeans.XmlException)17 Test (org.junit.Test)14 CTTbl (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl)13 CTAxDataSource (org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)12 CTNumDataSource (org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource)12 DefaultExchange (org.apache.camel.impl.DefaultExchange)10 ArrayList (java.util.ArrayList)9 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)9 CTP (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP)9 CTPicture (org.openxmlformats.schemas.presentationml.x2006.main.CTPicture)7 IOException (java.io.IOException)6 QName (javax.xml.namespace.QName)6 POIXMLException (org.apache.poi.POIXMLException)6 CTShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)6 CTGroupShape (org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape)6 CTGraphicalObjectFrame (org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame)5 Node (org.w3c.dom.Node)5 CTConnector (org.openxmlformats.schemas.presentationml.x2006.main.CTConnector)4