在apache camel mybatis中使用多个标签传递和处理xml文档

时间:2018-10-30 13:32:35

标签: xml apache-camel mybatis

假设我有这样的文档:

{ SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306
    at Utils.Promise.tap.then.catch.err (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:139:19)
    at tryCatcher (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/promise.js:690:18)
    at _drainQueueStep (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues (/Users/Stephen/Documents/_coding/hackReactorRemote/hrr34-fec/calendar-component/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
  name: 'SequelizeConnectionRefusedError',
  parent:
   { Error: connect ECONNREFUSED 127.0.0.1:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
     errno: 'ECONNREFUSED',
     code: 'ECONNREFUSED',
     syscall: 'connect',
     address: '127.0.0.1',
     port: 3306,
     fatal: true },
  original:
   { Error: connect ECONNREFUSED 127.0.0.1:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
     errno: 'ECONNREFUSED',
     code: 'ECONNREFUSED',
     syscall: 'connect',
     address: '127.0.0.1',
     port: 3306,
     fatal: true } }

我该如何处理呢?

我的意思是我要检查我的值是否等于此xml中的任何值。

<?xml version="1.0" encoding="UTF-8" ?>
 <main>
   <sub>1</sub>
   <sub>2</sub>
   <sub>3</sub>
   <sub>4</sub>
   <!-- and many, many elements like sub here don't know count of it -->
 </main>

有可能做这样的事情吗?

1 个答案:

答案 0 :(得分:0)

有两种实现方法。第一个是使用XPATH并获取值列表,并将其传递给iBatis调用。第二个方法是尝试将XML解组到POJO(使用JAXB等),然后提取值并调用iBatis。

XPath Example