Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7125

tokenizeXml fails when attributes have a / in them

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.12.2
    • 2.11.4, 2.12.3, 2.13.0
    • camel-core
    • None
    • Unknown

    Description

      tokenizeXml does not work or produce value xml output when attributes contain a /.

      The test below will fail under 2.12.2

      import org.apache.camel.EndpointInject;
      import org.apache.camel.Produce;
      import org.apache.camel.ProducerTemplate;
      import org.apache.camel.builder.RouteBuilder;
      import org.apache.camel.component.mock.MockEndpoint;
      import org.apache.camel.test.junit4.CamelTestSupport;
      import org.junit.Test;
      
      public class CamelTokenizeXmlTest extends CamelTestSupport {
      
        @EndpointInject(uri = "mock:result")
        protected MockEndpoint resultEndpoint;
        @Produce(uri = "direct:start")
        protected ProducerTemplate template;
      
        @Test
        public void testXmlWithSlash() throws Exception {
          String message = "<parent><child attr='/' /></parent>";
          resultEndpoint.expectedBodiesReceived("<child attr='/' />");
          template.sendBody(message);
          resultEndpoint.assertIsSatisfied();
        }
      
        @Override
        protected RouteBuilder createRouteBuilder() {
          return new RouteBuilder() {
            @Override
            public void configure() {
              from("direct:start").split().tokenizeXML("child").to("mock:result");
            }
          };
        }
      }
      

      Attachments

        Activity

          People

            njiang Willem Jiang
            mattnathan Matt Nathan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: