我有日志文件,我需要编写从这个文件获取所有xml的程序。 文件看起来像从原始文本文件中获取所有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
感谢。
^[A-ZA-Z] [A-ZA -z] {0,4} + [\ n] * $ –