在mule中处理重复的xml元素 1. 345 fg8 8384 2. 453 8. dsrsg 3. 3456 11 格里蒂
在这里,我必须捕获每个示例标记,并获取字符串值并插入到数据库中。我试图通过使用xpath获取值,但运气不好。还尝试转换为java对象。 请告诉我,如何处理这种情况 示例代码:在mule中处理重复的xml元素 1. 345 fg8 8384 2. 453 8. dsrsg 3. 3456 11 格里蒂,mule,Mule,在这里,我必须捕获每个示例标记,并获取字符串值并插入到数据库中。我试图通过使用xpath获取值,但运气不好。还尝试转换为java对象。 请告诉我,如何处理这种情况 示例代码: <?xml version="1.0" encoding="UTF-8"?> <root xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<input>
<rows>
<example>
<string>1</string>
<string>345</string>
<string>fg8</string>
<string>8384</string>
</example>
<example>
<string>2</string>
<string>453</string>
<string>8</string>
<string>dsrsg</string>
</example>
<example>
<string>3</string>
<string>3456</string>
<string>11</string>
<string>grthy</string>
</example>
</rows>
</input>
</root>
@muleDev,试试这个Dataweave脚本:
您使用了哪个版本的mule?我正在使用mule server 3.8.3尝试使用dataweave将其转换为java对象,而不是xpath3,然后使用集合拆分器或仅拆分器。@RalphRimorin也尝试过,但xml有重复的元素名(sting)这是dataweave::root={input={rows={example={string=grthy}}的输出
<http:listener config-ref="HTTP_Listener_Configuration1" path="/" doc:name="HTTP"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<byte-array-to-object-transformer mimeType="application/xml" doc:name="Byte Array to Object"/>
<splitter expression="#[xpath3('/*:root/input/rows', payload, 'NODESET')]" doc:name="Splitter"/>
<logger message="splitter : #[payload]" level="INFO" doc:name="Logger"/>