0

我有以下 HTML 示例可以使用 PHP 进行解析,并且在尝试解析“br”标签之间的数据时遇到了麻烦:

<div id="dump-list">    
<div class="dump-row"> 
 <div class="dump-location odd" data-jmapping="{id: 35, point: {lng: -73.00898601, lat: 41.71727402}, category: 'office'}">

    <div class="SingleLinkNoTx">
    <a href="#10" class="loc-link">Acme Software</a><br/><strong>John Doe, MBA</strong><br/>123 Main St.<br />New York, NY 10036<br /><strong class="telephone">(212) 555-1234</strong><br/>
    </div><!-- END.SingleLinkNoTx -->

    <a href="http://www.example.com" target="_blank" class="web_link">Visit Website</a><span><br />(0.3 miles)</span>   
    <div class="loc-info">
             <div class="loc-info-text ">
        John Doe, MBA<br /><a href="http://maps.google.com/?daddr=41.71727402,-73.00898601" target="_blank">Get Directions &raquo;</a>    
         </div>

    </div>

</div>

这个 PHP 代码片段:

//a[@class="loc-link"]//text()

句柄解析'a href'标签,但'br'呢?我试过这个:

//br[@class="loc-link"]//text()

但这不会返回任何输出。

如何解析以下内容以提取标签HTML之间的数据(公司名称、所有者、街道地址、城市、州、邮政编码) ?<br />

<div class="SingleLinkNoTx">
<a href="#10" class="loc-link">Acme Software</a><br/><strong>John Doe, MBA</strong>  <br/>123 Main St.<br />New York, NY 10036<br /><strong class="telephone">(212) 555- 1234</strong><br/>
</div><!-- END.SingleLinkNoTx -->
4

0 回答 0