2013-05-27 2 views
0

새롬지 오를 새롭기 때문에 xml을 업데이트해야합니다.그루비와 xml 슬러퍼를 사용하여 xml의 일부분을 삭제하십시오.

내 XML 내가 XML의 somepart를 제거해야하고, ::

<root xmlns=""><queries><query list="true" type="Query"><retrieve extent="3" offset="0" size="10000" subtype="uk.co.netdev.icr.provisioning.data.Corp"><criteria list="true" type="Criteria"><string-criteria expression="IAS" field-name="name"/></criteria></retrieve></query></queries></root> 

제안하십시오로 감사 출력을 인쇄해야이 XML에서

<?xml version="1.0" encoding="utf-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
<soapenv:Body> 
<root xmlns=""> 
<queries> 


<query list="true" type="Query"> 
<retrieve extent="3" offset="0" size="10000" subtype="uk.co.netdev.icr.provisioning.data.Corp"> 
<criteria list="true" type="Criteria"> 
<string-criteria expression="IAS" field-name="name"/> 
</criteria></retrieve></query> 
</queries></root></in0></soapenv:Body></soapenv:Envelope> 

::이다.

답변

0

나는이 당신이 필요 추측 : "</IN0>"

:

def soapMsg = new XmlSlurper().parseText(inputXml); 
def output = groovy.xml.XmlUtil.serialize(soapMsg.Body.root) 

은 BTW, 당신의 입력 XML은 위의 몇 가지 추가 태그가