0

源 XML

我需要它使用php3 html4输出到网页中。

来自 XML 的示例:

    <eveapi version="2">
    <currentTime>2013-09-30 10:29:10</currentTime>
        <result>
      <rowset name="corporateContactList" key="contactID" columns="contactID,contactName,standing,contactTypeID">
    <row contactID="90709010" contactName="Ebony Tears" standing="10" contactTypeID="1375"/>
    <row contactID="98061724" contactName="The Oasis Group" standing="10" contactTypeID="2"/>
    <row contactID="98117025" contactName="Templars Old Guard" standing="10" contactTypeID="2"/>
    <row contactID="98217933" contactName="TOG Combat Operations Group" standing="10" contactTypeID="2"/>
    <row contactID="99003256" contactName="The Cursed Few" standing="10" contactTypeID="16159"/>
    <row contactID="1144639749" contactName="Public listed Ferrets LTD" standing="5" contactTypeID="2"/>
    <row contactID="1178248549" contactName="Corcoran State" standing="10" contactTypeID="16159"/>
    <row contactID="1991939623" contactName="Kehlus Das" standing="5" contactTypeID="1373"/>
      </rowset>
      <rowset name="allianceContactList" key="contactID" columns="contactID,contactName,standing,contactTypeID">
    <row contactID="90713607" contactName="Lt Valari BOOMER" standing="5" contactTypeID="1374"/>
    <row contactID="91734185" contactName="Derrek Simalia" standing="10" contactTypeID="1386"/>
    <row contactID="98018265" contactName="Sicarius." standing="5" contactTypeID="2"/>
    <row contactID="98079777" contactName="Love And Hate" standing="10" contactTypeID="2"/>
    <row contactID="98081307" contactName="Imperial Marshal Office" standing="10" contactTypeID="2"/>
    <row contactID="98114169" contactName="Unity Member Corp Limited" standing="9.9" contactTypeID="2"/>
    <row contactID="98117025" contactName="Templars Old Guard" standing="5" contactTypeID="2"/>
    <row contactID="98127122" contactName="Rock Huggers Inc" standing="0" contactTypeID="2"/>
    <row contactID="98150751" contactName="Salishan Limited" standing="5" contactTypeID="2"/>
    <row contactID="98167186" contactName="Echoclone Inc." standing="9" contactTypeID="2"/>
    <row contactID="98170747" contactName="Rice And Roid Blasting Inc" standing="5" contactTypeID="2"/>
    <row contactID="98184944" contactName="Trianguli Australis" standing="-1" contactTypeID="2"/>
    <row contactID="98185728" contactName="NEW ORDER DEATH DEALERS" standing="-1" contactTypeID="2"/>
    <row contactID="98194301" contactName="Winds Of Neptune" standing="10" contactTypeID="2"/>
    <row contactID="98222095" contactName="Industrial Freakazoids" standing="5" contactTypeID="2"/>
    <row contactID="99000048" contactName="Nap or War" standing="5" contactTypeID="16159"/>
    <row contactID="99000122" contactName="Combat Mining and Logistics" standing="5" contactTypeID="16159"/>
    <row contactID="99001955" contactName="Whores in space" standing="0" contactTypeID="16159"/>
    <row contactID="99002605" contactName="Catastrophic Uprising" standing="5" contactTypeID="16159"/>
    <row contactID="99002775" contactName="CODE." standing="-1" contactTypeID="16159"/>
    <row contactID="99002968" contactName="Petition Blizzard" standing="0" contactTypeID="16159"/>
    <row contactID="99003256" contactName="The Cursed Few" standing="5" contactTypeID="16159"/>
    <row contactID="99003516" contactName="DEus MarCA" standing="5" contactTypeID="16159"/>
    <row contactID="99003530" contactName="R.I.S.E." standing="5" contactTypeID="16159"/>
    <row contactID="299995397" contactName="PCG Enterprises" standing="5" contactTypeID="2"/>
    <row contactID="367377882" contactName="Kraktor" standing="10" contactTypeID="1378"/>
    <row contactID="520574817" contactName="Kithan S'jet" standing="10" contactTypeID="1385"/>
    <row contactID="540221445" contactName="ken worth" standing="5" contactTypeID="1375"/>
    <row contactID="994783381" contactName="Duty." standing="5" contactTypeID="2"/>
    <row contactID="997614128" contactName="mollymaguire" standing="10" contactTypeID="1383"/>
    <row contactID="1025783526" contactName="TAXU" standing="0" contactTypeID="16159"/>
    <row contactID="1148460430" contactName="some neutral" standing="5" contactTypeID="1379"/>
    <row contactID="1354830081" contactName="Goonswarm Federation" standing="-5" contactTypeID="16159"/>
    <row contactID="1376273797" contactName="To Obviously Ninja You" standing="10" contactTypeID="2"/>
    <row contactID="1827461711" contactName="Mortal Destruction" standing="5" contactTypeID="16159"/>
      </rowset>
    </result>
  <cachedUntil>2013-09-30 10:44:10</cachedUntil>
</eveapi>

我需要的格式是一个具有以下结构的表格,基于每行中的信息:

<td class="standing"><a href="contactID">contactName</a></td><td class="standing">standing</td>

如果它可以按排名值排序也很好。

现在我可以使用以下命令将其拉入 php:

    <?php
    $xml=simplexml_load_file("https://api.eveonline.com/corp/ContactList.xml.aspx?keyID=2630929&vCode=LmMDqjYQYHRdEOg82d1qswA9AlE6Bx6himRTAupr67zkswQZnEhS04jena8WYFFt");
    print_r($xml);
    ?> 

    <?php
    $xml=simplexml_load_file("https://api.eveonline.com/corp/ContactList.xml.aspx?keyID=2630929&vCode=LmMDqjYQYHRdEOg82d1qswA9AlE6Bx6himRTAupr67zkswQZnEhS04jena8WYFFt");
    foreach ($xml->rowset as $rowset) {

        echo $rowset->row . "<br>";
    }

    ?> 

  <?php
    $xml=simplexml_load_file("https://api.eveonline.com/corp/ContactList.xml.aspx?keyID=2630929&vCode=LmMDqjYQYHRdEOg82d1qswA9AlE6Bx6himRTAupr67zkswQZnEhS04jena8WYFFt");
    foreac ($xml->rowset as $rowset) 
    echo $xml->getName()."";

    foreach($xml->row() as $child)
        {
            echo $child->contactID() . ": " . $child . "<br>";
        }
?>

但我只得到错误,或者完全没有。

所有帮助表示赞赏和感谢。

现在,更高的复杂性是我想要提供一个页面,但是使用 php 来隐藏元素,具体取决于单击的选项。

谢谢。

4

0 回答 0