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ファイルの上にあります。