我正在尝试使用 simplexml_load_file 读取 XML。以下是我的 XML:
<map_style>
<background_color>FFFFFF</background_color>
<state_color>c5d577</state_color>
<label_color>212121</label_color>
<state_hover_color>AECE13</state_hover_color>
<label_hover_color>FFFFFF</label_hover_color>
<state_inactive_color>dbe99c</state_inactive_color>
<label_inactive_color>212121</label_inactive_color>
<stroke_color>AECE13</stroke_color>
<lake_color>ffffff</lake_color>
<lake_stroke_color>ffffff</lake_stroke_color>
<other_color>FFFFFF</other_color>
<other_stroke_color>FFFFFF</other_stroke_color>
</map_style>
<!------for map on home page---------------->
<mapstyle_home mapOutlineColor="c2da78" mapRollOverColor="AECE13" mapGradientColor="AECE13"></mapstyle_home>
<!------for featured properties settings---------------->
<featured_property_style>
<layout width="203" height="182" background="#FFFFFF" imageBackground="#aec565" showGrid="1" autoPlayDefault="1" />
<buttons navigationDots="1" playPause="1" />
<text option="1" />
<featured_property_style>
我可以阅读 XML 直到</map_style>
. 但是,只要我添加:
<!------for map on home page---------------->
<mapstyle_home mapOutlineColor="c2da78" mapRollOverColor="AECE13" mapGradientColor="AECE13"></mapstyle_home>
<!------for featured properties settings---------------->
<featured_property_style>
<layout width="203" height="182" background="#FFFFFF" imageBackground="#aec565" showGrid="1" autoPlayDefault="1" />
<buttons navigationDots="1" playPause="1" />
<text option="1" />
<featured_property_style>
并尝试读取 XML,然后它会给出错误。
以下是我的代码:
$xml = simplexml_load_file($strCurlUrl);
//$xml = new SimpleXMLElement($strCurlUrl);
//echo $xml->getName() . "<br />";
$this->m_arrXml = array();
foreach($xml->children() as $child)
{
//echo $child->getName() . ": " . $child . "<br />";
$this->m_arrXml[$child->getName()] = $child;
}
$strCurlUrl
上面的xml文件在哪里。