有消息:
<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>
- 如何检查元素不为空?
- 如何添加新元素?