我是xpath的新手,我正在尝试使用带有“|”的多个表达式但是,当我将配置xml设置为:
时,分隔符<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
<jdbc-ee:mssql-data-source name="MS_SQL_Data_Source" user="username" password="passcode" url="jdbc:sqlserver://DOMAIN\SQLEXPRESS:65183;databaseName=MULETEST" transactionIsolation="UNSPECIFIED" doc:name="MS SQL Data Source"/>
<jdbc-ee:connector name="Database" dataSource-ref="MS_SQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<jdbc-ee:query key="InsertRecord" value="INSERT INTO databaseupdate(BuyerOrderNumber, OrderIssueDate) VALUES (#[xpath('//BuyerOrderNumber').text], #[xpath('//OrderIssueDate').text])"/>
</jdbc-ee:connector>
<flow name="Write_xml_file_to_databaseFlow1" doc:name="Write_xml_file_to_databaseFlow1">
<file:inbound-endpoint path="C:\mule" responseTimeout="10000" doc:name="File"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<splitter evaluator="xpath" expression="/Order/OrderHeader/OrderNumber|/Order/OrderHeader" doc:name="Splitter"/>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="InsertRecord" queryTimeout="-1" connector-ref="Database" doc:name="Destination"/>
</flow>
</mule>
我收到NULLPointerException。我的困惑在于xpath查询,如何硬编码多个表达式路径,并使用插入将其与xpath查询相关联? 感谢。