I want to match all contents inside the <div class="post_body" id="pid_"></div> tags... A sample of what I need to parse is below.
<tr>
<td class="trow2 post_content ">
<div class="post_body" id="pid_">
This is <span style="font-style: italic;">just a test</span> message.<br />
With an image.<br />
[img]http://www.somesite.com/wp-content/something.jpg[/img]<br />
Blah blah <span style="font-weight: bold;">blah</span>.<br />
<br />
The quick brown fox jumps over the lazy <span style="text-decoration: underline;">dawg</span>.<br />
<br />
[video=youtube]http://www.youtube.com/watch?v=MbYZa4gTxzM[/video]<br />
<br />
<a href="mailto:test@test.com">asd</a><br />
<ul>
<li>item number 1</li>
<li>item nubmer 2<br />
</li></ul>
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:<br />
</div><div class="body"><div dir="ltr"><code><span style="color: #66CCFF"><?php </span><span style="color: #7AC07C">echo </span><span style="color: #FF99FF">'he开发者_JAVA技巧llo world'</span><span style="color: #7AC07C">; </span><span style="color: #66CCFF">?></span></code></div></div></div>
<br />
<div style="text-align: center;">i am centered.</div>
<div style="text-align: right;">i am not centered.</div>
</div>
<div class="post_meta" id="post_meta_">
</div>
</td>
</tr>
As you can see, I intentionally added a whole bunch of stuff in-between the tags. This was the part where I needed help for. How do I detect the insides of the two tags I specified above given the fact that there are other tags in their way.
This is done in AS3 on Flash Builder.
If your HTML is XHTML, you can use XPath to parse and get the values inside those tags. See this question Parsing XML/XHTML in Actionscript
精彩评论