【发布时间】:2013-07-16 11:48:46
【问题描述】:
有消息:
<Employees xmlns="https://services">
<Employee>
<SNILS>111-111-111-1</SNILS>
<Name>Den</Name>
<Sex>M</Sex>
</Employee>
</Employees>
<Employees xmlns="https://services">
<Employee>
<SNILS>111-111-111-2</SNILS>
<Name>Elena</Name>
</Employee>
</Employees>
<Employees xmlns="https://services">
<Employee>
<SNILS>111-111-111-3</SNILS>
<Name>Elena</Name>
<Sex/>
</Employee>
</Employees>
输出应该是这样的:
<Employees xmlns="https://services">
<Employee>
<SNILS>111-111-111-1</SNILS>
<Name>Den</Name>
<Sex>M</Sex>
</Employee>
</Employees>
<Employees xmlns="https://services">
<Employee>
<SNILS>111-111-111-2</SNILS>
<Name>Elena</Name>
<Sex>W</Sex>
</Employee>
</Employees>
<Employees xmlns="https://services">
<Employee>
<SNILS>111-111-111-3</SNILS>
<Name>Elena</Name>
<Sex>W</Sex>
</Employee>
</Employees>
我们必须添加一个新元素。
- 如果它不存在
- 如果不为空
添加了框图:
输入我得到的值
<enrich>
<source xpath="get-property('VALUE')"/>
<target xmlns:t="https://services.rosminzdrav.ru/MedStaff" action="replace" type="custom" xpath="//t:Employee/t:Sex"/>
</enrich>
- 如何检查元素不为空?
- 如何添加新元素?
【问题讨论】: