當時在網上找了一個CDATA的轉換器
// States:
//
//
//
//
//
//
//
//
//
//
//
//
//
// (Yes
//
$state =
$a = str_split($xml);
$new_xml =
foreach ($a AS $k => $v) {
// Deal with "state"
switch ( $state ) {
case
if (
$state = $v;
} else {
$new_xml
}
break;
case
if (
$state = $state
} else {
$new_xml
$state =
}
break;
case
if (
$state = $state
} else {
$new_xml
$state =
}
break;
case
if (
$state = $state
} else {
$new_xml
$state =
}
break;
case
if (
$state = $state
} else {
$new_xml
$state =
}
break;
case
if (
$state = $state
} else {
$new_xml
$state =
}
break;
case
if (
$state = $state
} else {
$new_xml
$state =
}
break;
case
if (
$state = $state
} else {
$new_xml
$state =
}
break;
case
if (
$cdata =
$state =
} else {
$new_xml
$state =
}
break;
case
if (
$state = $v;
} else {
$cdata
}
break;
case
if (
$state = $state
} else {
$cdata
$state =
}
break;
case
if (
$new_xml
# $new_xml
// $new_xml
// str_replace(
// str_replace(
// str_replace(
// $cdata))));
$state =
} else {
$cdata
$state =
}
break;
} // switch
}
//
// Return
//
return $new_xml;
最近發現
發現是原來有xml的數據是<![CDATA[domain[test]]] >
而且這個問題很難修正
所以決定還是將這段解析 的代碼換成DOM XML
包含DOMElement
對於 DOMNode有nodeValue
首先先用loadXML將string轉化為DOMDocument對像
對於 <aa color=
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20144.html