dtvnnhh8992 2015-04-09 13:36
浏览 55

使用xml-string-streamer和Codeigniter

Is it possible to use a library such as the xml string streamer ( https://github.com/prewk/xml-string-streamer ) in Codeigniter? It utilises namespaces which Codeigniter doesn't recognise.

I'm currently using:

require_once 'application/libraries/XmlStringStreamer.php';

use application\libraries\XmlStringStreamer;

However, I now get:

Parse error: syntax error, unexpected T_USE

To clarify, I need to request 9 2mb+ sized xml streams, parse them, compare the data in each and output where there are discrepancies as quickly as possible (aiming for ~5 seconds at most). This is my last try, as the structure of the XML files is similar to:

<competition>
 <season>
  <round>
   <match>
    <matchinfo>
     <venue/>
     <referee/>
     <assistant_referee/>
     <assistant_referee/>
     <fourth_official/>
     <attendance/>
     <coach_team_a/>
     <coach_team_b/>
    </matchinfo>
    <lineups/>
    <lineups_bench/>
    <substitutions/>
    <penalty_shootout/>
    <goals/>
    <bookings/>
    <extra/>
   </match>
  </round>
 </season>
</competition>

With upto 600 competition elements in each stream, numerous attributes in each element, and all elements needed except lineups, lineups_bench, substitutions, penalty_shootout, goals, bookings and extra, so if you have any other suggestions that would be helpful. When we were comparing much fewer competitions, I was using XMLReader to pull out and parse the Competition block, then converting each competition element into a SimpleXML object, but with 600 competitions, I need to find a way of reducing how much I'm downloading.

The more I look at it, the more I think this XML isn't fit for the task, so this is my last try before requesting a change to the API generating the XML or I'll try to stream smaller datasets somehow.

  • 写回答

1条回答 默认 最新

  • dongquan8753 2016-02-15 09:33
    关注

    Please check your PHP version as if it support the usage of this line :

    use application\libraries\XmlStringStreamer;
    

    if not , just upgrade your php version to the latest one. have a nice day :)

    评论

报告相同问题?

悬赏问题

  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错