javascript解析返回的xml各式的字符串
<script>
var flags ;
if(window.XMLHttpRequest) {
XMLHttpReq = new XMLHttpRequest(); //firefox下执行此语句
}
else if(window.ActiveXObject) {
try{
XMLHttpReq = new ActiveXObject("Msxm12.XMLHTTP");
}catch(e){
try{
XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e) {}
}
}
XMLHttpReq.open("post","getDate.jsp",false);
XMLHttpReq.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;charset=UTF-8");
XMLHttpReq.onreadystatechange = function () {
var statePending = XMLHttpReq.readyState;
if (statePending == 4&& XMLHttpReq.status==200)
{
if(window.ActiveXObject){
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = false;
xmlDoc.loadXML(XMLHttpReq.responseText.replace(/(^\s*)/g, ""));
} else if (document.implementation&&document.implementation.createDocument){
XMLHttpReq.open("GET",XMLHttpReq.responseText.replace(/(^\s*)/g, ""),false);
XMLHttpReq.send(null);
xmlDoc = XMLHttpReq.responseXML;
//return new XMLSerializer().serializeToString(xmlDoc);
}
flags = xmlDoc.getElementsByTagName("content");
}
}
XMLHttpReq.send(null);
for(var i =0;i<flags.length;i++)
{
var content = flags[i]; //得一个content结
相关文档:
嵌入式GUI FTK介绍(3)-XML界面描述语言
转载时请注明出处和作者联系方式
文章出处:http://www.limodev.cn/blog
作者联系方式:李先静 <xianjimli at hotmail dot com>
用XML来描述界面,C/C++写内部逻辑,用脚本语言来胶合界面和内部逻辑。FTK正是基于这种思想来设计的,所以它自然会提供 XML界面描述功能,在 ......
<!-- xml格式
<foo xmlns="test">
<bar attr='a'></bar>
<bar attr='b'></bar>
<bar attr='c'></bar>
</foo>
-->
<?php
$dom = new DOMDocument();
if (!$dom->load('attr.xml'))
{
echo "load books.xml failed!<br>";
re ......
Several programming languages implement a sprintf function, to output a formatted string. It originated from the C programming language, printf function. Its a string manipulation function.
This is limited sprintf Javascript implementation. Function returns a string formatted by the usual printf co ......
以下以 IE 代替 Internet Explorer,以 MF 代替 Mozzila Firefox
1. document.form.item 问题
(1)现有问题:
现有代码中存在许多 document.formName.item("itemName") 这样的语句,不能在 MF 下运行
(2)解决方法:
&nb ......