我有日志文件,我需要编写从该文件中获取所有 xml 的程序。文件看起来像
text
text
xml
text
xml
text
etc
你能给我建议什么更好地使用正则表达式或其他东西吗?也许可以用 dom4j 做到这一点?
如果我尝试使用正则表达式,我会看到文本部分有<>
标签的下一个问题。
更新 1: XML 示例
SOAP message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
here is body part of valid xml
</soapenv:Body>
</soapenv:Envelope>
text,text,text,text
symbols etc
SOAP message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
here is body part of valid xml
</soapenv:Body>
</soapenv:Envelope>
text,text,text,text
symbols etc
谢谢。