Package org.apache.camel.converter.jaxp

Examples of org.apache.camel.converter.jaxp.XmlConverter


                    public void process(Exchange exchange) throws Exception {
                        CxfPayload<?> payload = exchange.getIn().getBody(CxfPayload.class);
                        List<Source> elements = payload.getBodySources();
                        assertNotNull("We should get the elements here" , elements);
                        assertEquals("Get the wrong elements size" , elements.size(), 1);
                        Element el = new XmlConverter().toDOMElement(elements.get(0));
                        assertEquals("Get the wrong namespace URI" , el.getNamespaceURI(), "http://cxf.component.camel.apache.org/");
                    }
                   
                })
                .to(serviceEndpointURI);
View Full Code Here


                       
                        CxfPayload<?> payload = exchange.getIn().getBody(CxfPayload.class);
                        List<Source> elements = payload.getBodySources();
                        assertNotNull("We should get the elements here" , elements);
                        assertEquals("Get the wrong elements size" , elements.size(), 1);
                        Element el = new XmlConverter().toDOMElement(elements.get(0));
                        assertEquals("Get the wrong namespace URI" , el.getNamespaceURI(), "http://cxf.component.camel.apache.org/");
                    }
                   
                })
                .to(serviceEndpointURI);
View Full Code Here

                        List<String> params = new ArrayList<String>();

                        if (message != null) {
                            // convert CxfPayload to list of objects any way you like
                            Element element = new XmlConverter().toDOMElement(message.getBody().get(0));
                            params.add(element.getFirstChild().getTextContent());
                        }
                           
                        // replace the body
                        exchange.getIn().setBody(params);
View Full Code Here

     *   1) This requires the message to be fully loaded breaking the streaming
     *   2) For large messages, the result can be a VERY large String and require
     *   large amounts of memory.
     */
    public String toString() {
        XmlConverter converter = new XmlConverter();
        StringBuilder buf = new StringBuilder();
        buf.append(getClass().getName());
        buf.append(" headers: " + headers);
        // go through the list of element and turn it into String
        if (body == null) {
            buf.append("body: " + body);
        } else {
            buf.append("body: [ ");
            for (Element src : getBody()) {
                String elementString = "";
                try {
                    elementString = converter.toString(src, null);
                } catch (TransformerException e) {
                    elementString = src.toString();
                }
                buf.append("[" + elementString + "]");
            }
View Full Code Here

                        CxfPayload<?> payload = exchange.getIn().getBody(CxfPayload.class);
                        List<Source> elements = payload.getBodySources();
                        assertNotNull("We should get the elements here" , elements);
                        assertEquals("Get the wrong elements size" , elements.size(), 1);
                       
                        Element el = new XmlConverter().toDOMElement(elements.get(0));
                        assertEquals("Get the wrong namespace URI" , el.getNamespaceURI(), "http://cxf.component.camel.apache.org/");
                    }
                   
                })
                .to("cxf:bean:serviceEndpoint?dataFormat=PAYLOAD");
View Full Code Here

        Map<String, String> ns = new HashMap<String, String>();
        ns.put("ns", MtomTestHelper.SERVICE_TYPES_NS);
        ns.put("xop", MtomTestHelper.XOP_NS);
       
        XPathUtils xu = new XPathUtils(ns);
        Element oute = new XmlConverter().toDOMElement(out.getBody().get(0));
        Element ele = (Element)xu.getValue("//ns:DetailResponse/ns:photo/xop:Include", oute,
                                           XPathConstants.NODE);
        String photoId = ele.getAttribute("href").substring(4); // skip "cid:"

        ele = (Element)xu.getValue("//ns:DetailResponse/ns:image/xop:Include", oute,
View Full Code Here

            Map<String, String> ns = new HashMap<String, String>();
            ns.put("ns", MtomTestHelper.SERVICE_TYPES_NS);
            ns.put("xop", MtomTestHelper.XOP_NS);

            XPathUtils xu = new XPathUtils(ns);
            Element body = new XmlConverter().toDOMElement(in.getBody().get(0));
            Element ele = (Element)xu.getValue("//ns:Detail/ns:photo/xop:Include", body,
                                               XPathConstants.NODE);
            String photoId = ele.getAttribute("href").substring(4); // skip "cid:"
            Assert.assertEquals(MtomTestHelper.REQ_PHOTO_CID, photoId);
View Full Code Here

            dataFormat.setMethod("html");
            Node doc = dataFormat.asNodeTidyMarkup(new BufferedInputStream(url.openStream()));
            XPath xpath = XPathFactory.newInstance().newXPath();
            Node nd = (Node)xpath.evaluate("//div[@class='" + contentDivClass + "']", doc, XPathConstants.NODE);
            if (nd != null) {
                return  new XmlConverter().toString(nd, null);
            }
        } catch (Throwable e) {
            if (errorOnDownloadFailure) {
                throw new MojoExecutionException("Download or validation of '" + page + "' failed: " + e);
            } else {
View Full Code Here

        final Resource resource = resolveMandatoryResource(remaining);
        log.debug("{} using schema resource: {}", this, resource);
        final XsltBuilder xslt = getCamelContext().getInjector().newInstance(XsltBuilder.class);

        // lets allow the converter to be configured
        XmlConverter converter = resolveAndRemoveReferenceParameter(parameters, "converter", XmlConverter.class);
        if (converter == null) {
            converter = getXmlConverter();
        }
        if (converter != null) {
            xslt.setConverter(converter);
View Full Code Here

        successEndpoint.assertIsSatisfied();
        exceptionEndpoint.assertIsSatisfied();

        StreamSource body = (StreamSource) exceptionEndpoint.getExchanges().get(0).getIn().getBody();
        assertEquals("Ensure message re-readability in the exception handler", xml, new XmlConverter().toString(body, null));
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.converter.jaxp.XmlConverter

Copyright © 2018 www.massapicom. 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.