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

Why tokenize (and some others) does not support properties substitution?

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Unknown

      Description

      Hi,
      I'm trying to use the properties substitution in my tokenizer with no success.
      I've also just seen that the camel-spring.xsd definition does not declare:

      <xs:anyAttribute namespace="##other" processContents="skip"/>

      In many complex types, so spring is not able to use the defined 'prop' namespace as prefix for the tokenizer and csv parser.

      This is my route and I'd like the substitute the 'csv.row.delimiter', 'csv.row.group' (in the tokenizer) and csv.row.delimiter (in the csv)

      <route>
      <!-- ACTUALLY READ THE CSV stream -->
      <from uri="seda:splitting" />
      <split parallelProcessing="false" stopOnException="false" streaming="true">
      <tokenize prop:token="csv.row.delimiter" prop:group="csv.row.group" />
      <unmarshal>
      <csv autogenColumns="true" prop:delimiter="csv.row.delimiter"
      skipFirstLine="false" useMaps="true" configRef="csvConfig"
      lazyLoad="false" />
      </unmarshal>

      <to uri="seda:processing" />
      </split>
      </route>

      Is there a concrete need for this situation? If ther's not, you'll consider to merge a contribution patch on this?

      I'm using the master branch so I'm on 2.14-SNAPSHOT

      If you kindly want to check here:
      https://github.com/ccancellieri/camel_poc/blob/master/src/main/resources/META-INF/spring/camel-context.xml#L79
      (at line 79) is commented out what I was trying to use (with no success).
      As you could see I'm using it in the file endpoint url and it works so there's no problem with file recognition.

      In the properties file I've:
      csv.row.group=2
      csv.row.delimiter=\n

      The error is:
      Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 79 in XML document from file [/home/carlo/work/code/java/camel_poc/target/classes/META-INF/spring/camel-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'prop:token' is not allowed to appear in element 'tokenize'.
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
      at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
      at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
      at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:204)
      at org.apache.camel.spring.Main.doStart(Main.java:156)
      at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
      at org.apache.camel.main.MainSupport.run(MainSupport.java:147)
      at org.apache.camel.main.MainSupport.run(MainSupport.java:351)
      at org.apache.camel.spring.Main.main(Main.java:89)
      Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'prop:token' is not allowed to appear in element 'tokenize'.
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:423)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3188)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2665)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2072)
      at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:731)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
      at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
      at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
      at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
      at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
      ... 19 more

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              ccancellieri carlo cancellieri
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: