I would like to know how to remove all elements from an xml file which do not have a first attribute of type name or ref. The child elements that DO contain a first attribute of the required type must stay even if the parent has been deleted and they should just be moved up in the hierarchy
For example, if this is the input file:
<xs:element name="Body" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType>
<xs:sequence>
<xs:element ref="Client" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Risk" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Claim" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Complaint" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="ClientFee" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="User" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
I would expect the following output:
<xs:element name="Body" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element ref="Client" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Risk" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Claim" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="Complaint" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="ClientFee" minOccurs="0" maxOccurs="unbounded" />
<xs:element ref="User" minOccurs="0" />
</xs:element>
For example this way: