我试图通过我指向的标签将 html 文件分隔为 2。
例子
<html> <head> <title>html title</title> </head> <body> <h1>hello title</h1> <p class="p2"> <span>here is some txt</span> </p> <p class="p2"> hello test, <a id="chp"></a>here is some txt </p> </body> </html>
如果我定义分隔符是<a id="chp"></a>。这两个文件应该如下
文件 1:
<html> <head> <title>html title</title> </head> <body> <h1>hello title</h1> <p class="p2"> <span>here is some txt</span> </p> <p class="p2"> hello test, </p> </body> </html>
文件 2:
<html> <head> <title>html title</title> </head> <body> <h1>hello title</h1> <p class="p2"> <span>here is some txt</span> </p> <p class="p2"> <a id="chp"></a>here is some txt </p> </body> </html>
谁能告诉我如何实现这个?
谢谢