aldettinger commented on code in PR #5346:
URL: https://github.com/apache/camel-quarkus/pull/5346#discussion_r1335974857


##########
integration-tests/xml-jaxp/src/main/java/apache/camel/quarkus/component/xml/jaxp/XmlJaxpRoutes.java:
##########
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package apache.camel.quarkus.component.xml.jaxp;
+
+import java.io.ByteArrayOutputStream;
+import java.io.Reader;
+import java.nio.charset.StandardCharsets;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.util.xml.BytesSource;
+
+public class XmlJaxpRoutes extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("direct:documentConvert")
+                .convertBodyTo(Document.class)
+                .process(exchange -> {
+                    Document document = 
exchange.getMessage().getBody(Document.class);
+                    Element element = document.createElement("bar");
+                    element.setTextContent("Bar Text");
+                    document.getDocumentElement().appendChild(element);
+                })
+                .convertBodyTo(String.class);
+
+        from("direct:elementConvert")
+                .convertBodyTo(Document.class)
+                .process(exchange -> {
+                    Document document = 
exchange.getMessage().getBody(Document.class);
+                    Element element = document.createElement("bar");
+                    element.setTextContent("Bar Text");
+                    document.getDocumentElement().appendChild(element);
+                })
+                .convertBodyTo(Element.class)
+                .convertBodyTo(String.class);
+
+        from("direct:byteSourceConvert")
+                .convertBodyTo(byte[].class)
+                .convertBodyTo(BytesSource.class)
+                .convertBodyTo(String.class);
+
+        from("direct:sourceConvert")
+                .convertBodyTo(Source.class)
+                .convertBodyTo(String.class);
+
+        from("direct:domSourceConvert")
+                .convertBodyTo(byte[].class)
+                .convertBodyTo(DOMSource.class)
+                .convertBodyTo(String.class);
+
+        from("direct:saxSourceConvert")
+                .convertBodyTo(SAXSource.class)
+                .convertBodyTo(String.class);
+
+        from("direct:staxSourceConvert")
+                .convertBodyTo(StAXSource.class)
+                .convertBodyTo(String.class);
+
+        from("direct:streamSourceConvert")
+                .convertBodyTo(StreamSource.class)
+                .convertBodyTo(String.class);
+
+        from("direct:streamSourceReaderConvert")
+                .convertBodyTo(StreamSource.class)
+                .convertBodyTo(Reader.class)
+                .convertBodyTo(String.class);
+
+        from("direct:xmlStreamReaderCharsetConvert")
+                .convertBodyTo(XMLStreamReader.class, 
StandardCharsets.ISO_8859_1.name())

Review Comment:
   Agree, `XMLStreamReader` should be provided a  `ISO-8859-1` encoded byte 
array now :+1: 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to