我有一个下面的XML。我需要将来自Soap请求的整个xml存储在一个变量中。在
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cre="http://www.code.com/abc/V1/createCase">
<soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/2" xmlns:wsu="http://docs.oasis-open.org/a.xsd"></wsse:Security>
</soapenv:Header>
<soapenv:Body xmlns:wsu="http://docs.oasis-open.org/30.xsd" wsu:Id="id-14">
<cre:createCase>
<cre:Request>
<cre:ServiceAttributesGrp>
<cre:MinorVer>?</cre:MinorVer>
</cre:ServiceAttributesGrp>
<cre:CreateCaseReqGrp>
<cre:Language>English</cre:Language>
<cre:CustFirstNm>Issue</cre:CustFirstNm>
<cre:CustLastNm>Detection</cre:CustLastNm>
<cre:AddlDynInfoGrp>
<cre:AddlDynInfo>
<cre:FieldNm>TM3</cre:FieldNm>
<cre:FieldVal></cre:FieldVal>
</cre:AddlDynInfo>
<cre:AddlDynInfo>
<cre:FieldNm>PM417</cre:FieldNm>
<cre:FieldVal>Not Defined</cre:FieldVal>
</cre:AddlDynInfo>
</cre:AddlDynInfoGrp>
<cre:CreateCriteriasGrp>
<cre:CreateCriterias>
<cre:CriteriaNm>CriticalReqDtlValidationReqd</cre:CriteriaNm>
</cre:CreateCriterias>
</cre:CreateCriteriasGrp>
</cre:CreateCaseReqGrp>
</cre:Request>
</cre:createCase>
</soapenv:Body>
</soapenv:Envelope>
目前,我正在尝试以以下方式打印,但我无法:
^{pr2}$我只需要打印createCase部分。在
我将您的xml转储到变量
root
,下面是如何获取xml片段:打印此:
^{pr2}$编辑: OP使用的python/lxml的旧版本不带名称空间,正确的代码是:
相关问题 更多 >
编程相关推荐