如何在保持原始單詞順序的同時解析與此處顯示的類似的xml?我的目標是僅提取第一個<span>
-tag和<strong>
-tag的內容,但詞語順序應保持不變(輸出應該是:國際清算銀行[BIZ])。我嘗試使用內置的php解析器(XML DOM和SimpleXML - Get),但是我無法保留單詞的順序。如何解析XML,同時在php中保留單詞的原始順序?
<span class="full_collocation">
the<strong class="tilde">Bank</strong> for International Settlements
</span>
<span class="full_collocation">
[<span class="or"><acronym title="or">or</acronym></span> BIZ]
</span>
[如何剝離所有HTML標籤?(http://php.net/manual/en/function.strip-tags.php) – GiamPy
我不想保持休息,在這種情況下,「或」 –