【发布时间】:2014-10-14 17:40:55
【问题描述】:
<listing>
<Community>
<commons:Subdivision commons:isgSecurityClass="Public">Cheat Crossings</commons:Subdivision>
<commons:Schools>
<commons:School>
<commons:Name>Valley View</commons:Name>
<commons:SchoolCategory>Elementary</commons:SchoolCategory>
<commons:District commons:isgSecurityClass="Public">Monongalia</commons:District>
<commons:Description>true</commons:Description>
</commons:School>
<commons:School>
<commons:Name>MHS</commons:Name>
<commons:SchoolCategory>High</commons:SchoolCategory>
<commons:District commons:isgSecurityClass="Public">Monongalia</commons:District>
<commons:Description>true</commons:Description>
</commons:School>
<commons:School>
<commons:Name>Morgantown Jr High School</commons:Name>
<commons:SchoolCategory>JuniorHigh</commons:SchoolCategory>
<commons:District commons:isgSecurityClass="Public">Monongalia</commons:District>
<commons:Description>true</commons:Description>
</commons:School>
<commons:School>
<commons:Name>South</commons:Name>
<commons:SchoolCategory>Middle</commons:SchoolCategory>
<commons:District commons:isgSecurityClass="Public">Monongalia</commons:District>
<commons:Description>true</commons:Description>
</commons:School>
</commons:Schools>
</Community>
我如何获得学校标签下的所有学校记录? 我试过这个,但它不工作。 $eachListing->社区->学校->儿童("commons",true);
【问题讨论】:
-
你用什么来解析 xml(simpleXML 或 DOMDocument)?
-
我正在使用 simpleXML
-
你能显示
commons命名空间的定义吗? -
不,我没有。我所有的那个xml和类型是“xs:string”
标签: php xml xml-parsing