我有一个保存在 String 中的 xml 文档。字符串是这样的:
<?xml version=\"1.0\" encoding=\"http://schemas.xmlsoap.org/soap/envelope/\" standalone=\"no\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><axis2:ServiceGroupId xmlns:axis2=\"http://ws.apache.org/namespaces/axis2\" wsa:IsReferenceParameter=\"true\">urn:uuid:2BC5F552AF3179755C1348038695049</axis2:ServiceGroupId><wsa:To>http://localhost:8081/axis2/services/TCAQSRBase</wsa:To><wsa:MessageID>urn:uuid:599362E68F35A38AFA1348038695733</wsa:MessageID><wsa:Action>http://www.transcat-plm.com/TCAQSRBase/TCAQSR_BAS_ServerGetOsVariable</wsa:Action></soapenv:Header><soapenv:Body><ns1:TCAQSR_BAS_ServerGetOsVariableInput xmlns:ns1=\"http://www.transcat-plm.com/TCAQSRBase/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"ns1:TCAQSR_BAS_ServerGetOsVariableInputType\"><ns1:TCAQSR_BAS_BaseServerGetInputKey>USERNAME</ns1:TCAQSR_BAS_BaseServerGetInputKey></ns1:TCAQSR_BAS_ServerGetOsVariableInput></soapenv:Body></soapenv:Envelope>
我不知道它将如何在字符串中表示。
但我想提取和之间的术语<axis2:ServiceGroupId xmlns:axis2="http://ws.apache.org/namespaces/axis2">
,</axis2:ServiceGroupId>
它是一个 urn:uuid: 并想将结果保存在一个字符串中。我知道 xpath,但就我而言,我不能使用 xpath。
并且非常感谢任何帮助。
提前非常感谢。