已关闭。此问题需要更多focused。当前不接受答案。
**想要改进此问题吗?**更新问题,使其仅关注editing this post的一个问题。
5天前关闭。
Improve this question
我有两条消息,第一条消息如下。应该匹配的元素是root/items/data/subscription_id
<?xml version="1.0" encoding="UTF-8"?>
<root>
<id>AX8a8aa</id>
<type>invoice</type>
<billing_document_number>FRIN218</billing_document_number>
<state>open</state>
<account>
<account_number>X00204</account_number>
<custom_fields>
<Country__c>France</Country__c>
<Entity__c>Local Subsidiary</Entity__c>
</custom_fields>
</account>
<items>
<data>
<amount>1161</amount>
<service_end>2023-05-31</service_end>
<service_start>2022-06-01</service_start>
<subscription_id>8a8aa</subscription_id>
<taxation_items>
<tax_rate_name>TVA</tax_rate_name>
</taxation_items>
</data>
<data>
<amount>-104.25</amount>
<service_end>2022-06-30</service_end>
<service_start>2022-06-01</service_start>
<subscription_id>8a8aa</subscription_id>
<taxation_items>
<tax_rate_name>TVA</tax_rate_name>
</taxation_items>
</data>
<data>
<amount>-104.25</amount>
<service_end>2022-09-30</service_end>
<service_start>2022-09-01</service_start>
<subscription_id>91abd</subscription_id>
<taxation_items>
<tax_rate_name>TVA</tax_rate_name>
</taxation_items>
</data>
</items>
</root>
第二条消息如下所示;它提供了关于订阅的更多细节。
<?xml version="1.0" encoding="UTF-8"?>
<root>
<id>8a8aa</id>
<notes>test 1</notes>
<CUP__c/>
</root>
我需要根据消息1合并两个有效负载:根目录-〉项目-〉数据-〉订阅标识=消息2:根-〉id
预期输出应如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<id>AX8a8aa</id>
<type>invoice</type>
<billing_document_number>FRIN218</billing_document_number>
<state>open</state>
<account>
<account_number>X00204</account_number>
<custom_fields>
<Country__c>France</Country__c>
<Entity__c>Local Subsidiary</Entity__c>
<SAP_ReceiverInternalID__c/>
</custom_fields>
</account>
<items>
<data>
<amount>1161</amount>
<service_end>2023-05-31</service_end>
<service_start>2022-06-01</service_start>
<subscription_id>8a8aa</subscription_id>
<taxation_items>
<tax_rate_name>TVA</tax_rate_name>
</taxation_items>
<id>8a8aa</id>
<CUP__c/>
<notes>test 1</notes>
</data>
</items>
</root>
2条答案
按热度按时间wljmcqd81#
我试过这个,但它包含根元素,我不想这样
回应是
esyap4oy2#
这一个工作正常: