小编use*_*107的帖子

使用PHP和XMLReader解析XML

我一直在尝试使用PHP和XMLReader解析一个非常大的XML文件,但似乎无法得到我正在寻找的结果.基本上,我正在搜索大量的信息,如果a包含某个zipcode,我想返回那一点XML,或继续搜索,直到找到该zipcode.从本质上讲,我将把这个大文件分解成只有几个小块,所以不必查看数千或数百万组信息,它可能是10或20.

这里有一些我喜欢的XML

//search through xml
<lineups country="USA">
//cache TX02217 as a variable
 <headend headendId="TX02217">
//cache Grande Gables at The Terrace as a variable
  <name>Grande Gables at The Terrace</name>
//cache Grande Communications as a variable
  <mso msoId="17541">Grande Communications</mso>
  <marketIds>
   <marketId type="DMA">635</marketId>
  </marketIds>
//check to see if any of the postal codes are equal to $pc variable that will be set in the php
  <postalCodes>
   <postalCode>11111</postalCode>
   <postalCode>22222</postalCode>
   <postalCode>33333</postalCode>
   <postalCode>78746</postalCode>
  </postalCodes>
//cache Austin to a variable
  <location>Austin</location>
  <lineup>
//cache all prgSvcID's to an …
Run Code Online (Sandbox Code Playgroud)

php xml xmlreader

4
推荐指数
1
解决办法
9041
查看次数

标签 统计

php ×1

xml ×1

xmlreader ×1