简单的HTML DOM同时找到多个标签

时间:2014-11-21 01:18:52

标签: tags simple-html-dom simultaneous

我有一个字符串:

<h2>header 1</h2>
<p>paragraph 1</p>
<h2>header 2</h2>
<h3>siausjfks</h3>
....(anything not containing h2 and p tags)

<div><h2>header 3</h2> jasgfks</div>
.... (anything not containing h2 and p tags)
<p>paragraph 2</p>

现在我想要数组

element 1 = header 1
element 2 = paragraph 1
element 3 = header 2
element 4 = header 3
element 5 = paragraph 2

有没有办法使用简单的HTML DOM实现这一目标?

谢谢:)

更新:这实际上是同时找到2个标签,如何找到3个,4个以及更多标签?

0 个答案:

没有答案