I have an xml file and I need to select (not remove) an specific node with its children. I know how to remove one with its children, but not how to remove all but these.
The input xml file looks like this
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-8"> <wsse:Username>john</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body> <seq:Request xmlns:seq="http://schemas.mycompany.com/schema_v1_0"> <seq:StoreId>6</seq:StoreId> <seq:Concept>2</seq:Concept> <seq:ProductGr> <seq:ProductGroupID>10</seq:ProductGroupID> <seq:Seq>150</seq:Seq> <seq:Update>1</seq:Update> </seq:ProductGr> </seq:Request> </soapenv:Body> </soapenv:Envelope> and I want only to obtain the following chunk of code
<seq:Request xmlns:seq="http://schemas.mycompany.com/schema_v1_0"> <seq:StoreId>6</seq:StoreId> <seq:Concept>2</seq:Concept> <seq:ProductGr> <seq:ProductGroupID>10</seq:ProductGroupID> <seq:Seq>150</seq:Seq> <seq:Update>1</seq:Update> </seq:ProductGr> </seq:Request> Can you help me? In addition, the prefix of the namespace can vary, altough not the namespace itself.
Thanks for your help.