Я хочу отсортировать xml-файл по значению атрибута "class" элемента "entity".В выводе я хочу сохранить ту же структуру моего входного XML, здесь часть моего XML-кода:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<entity class="entityZ" metadata-complete="false">
<table name="F_ENTITYZ">
<unique-constraint>
<column-name>column1</column-name>
</unique-constraint>
<unique-constraint>
<column-name>column2</column-name>
</unique-constraint>
</table>
<sequence-generator name="SEQUENCEZ_" sequence-name="F_SEQUENCEZ_" allocation-size="1" initial-value="1"/>
<attributes>
</attributes>
</entity>
<entity class="entityA" metadata-complete="false">
<table name="F_ENTITYA">
<unique-constraint>
<column-name>column1</column-name>
</unique-constraint>
</table>
<sequence-generator name="SEQUENCEA_" sequence-name="F_SEQUENCEA_" allocation-size="1" initial-value="1"/>
<attributes>
</attributes>
<post-persist method-name="traceHistory"/>
<post-update method-name="traceHistory"/>
</entity>
<entity class="entityB" metadata-complete="false">
<table name="F_ENTITYB">
<unique-constraint>
<column-name>column1</column-name>
</unique-constraint>
</table>
<sequence-generator name="SEQUENCEB_" sequence-name="F_SEQUENCEB_" allocation-size="1" initial-value="1"/>
<attributes>
</attributes>
</entity>
</entity-mappings>
В ожидании вашей помощи ...