我有一個帶有XML數據塊的文檔,但每個塊之間都有純文本。我如何提取XML數據?將文本文件拆分爲XML
即
blah blah blah
===: text text text :===
<?xml version="1.0" ?>
<Data>
<Line>information</Line>
<Line2>more information</Line2>
</Data>
===: text text text :===
blah blah blah
blah blah blah
===: text text text :===
<?xml version="1.0" ?>
<Data>
<Line>2nd information</Line>
<Line2>more information</Line2>
</Data>
===: text text text :===
blah blah blah
文本withing的===:===將永遠是不同的,但不需要被包括在內。
更加具體談談那些'===:文字文字文字:==='線,它們是文字,總是存在於完全相同的辦法? –
它每次都會有所不同,分隔符有一個時間戳和一堆其他信息 – frebbie
信息還有點短。一個文件能否以XML開頭或者在第一個xml之前總會有一個'===:...:==='行? –