/*var n=new XMLParse(this.req.responseXML,'',"fri",'data');
	第一参数固定，第二可空默认为<li><a href='{{path}}' target='_blank'>{{title}}</a></li>，第三是容器id,第四为xml中数据根节点
var n1=new XMLParse(this.req.responseXML,'<li><a href="{{path}}"><img src="{{img}}" width="300" /></a></li>',"fri",'data');
	n1.setAttr('path',"{{path}}");
	n1.setAttr('img',"{{img}}");
	n1.show();
	
	path等与xml节点对应
	<?xml version=""1.0"" encoding=""utf-8""?>
	<datas>
		<data attr="333">
			<path>ddd</path>
			<title>中国国际贸易促进委员会</title>
		</data>
		<data>
			<path>333</path>
			<title>333</title>
		</data>
	</datas>
tmpt 为空时使用默认模版
自定模版需要setAttr("xmlTag","{{htmlNote}}")
xmlTag第一个字母为"#"时，xmlTag为xml属性
自定模版的{{}}界定符可改*/
String.prototype.trim=function(){
  return this.replace(/^(?:\s|　|&nbsp;|<br \/>)*|(?:\s|　|&nbsp;|<br \/>)*$/g,"");
}
function XMLParse(xml,tmpt,conID,dataRoot){
	this.xml=xml;
	this.root=dataRoot;
	this.tmpt=tmpt?tmpt:"<li><a href='{{path}}' target='_blank'>{{title}}</a></li>";
	this.container=conID?(typeof(conID)=="object"?conID:$$("#"+conID)):null;
	this.tags=tmpt?{}:{path:"{{path}}",title:"{{title}}"};
}
XMLParse.prototype={
	setAttr:function(xmlTag,htmlNote){
		this.tags[xmlTag]=htmlNote;
	},
	show:function(){
		var d=$$(this.root,this.xml),dc,len=d.length,dataNode,tags,tag,attrV,tmpt,html="";
		tmpt=this.tmpt;
		tags=this.tags;
		for(var i=0;i<len;i++){
			dc=d[i];
			tmptTemp=tmpt;
			for(var j in tags){
					attrV=tags[j];
					if(j.substring(0,1)=="#"){
						tag=j.substring(1);
						tmptTemp=replaceAll(tmptTemp,attrV,dc.getAttribute(tag));
					}else{
						dataNode=$$(j,dc)[0].firstChild;
						tmptTemp=replaceAll(tmptTemp,attrV,dataNode?dataNode.nodeValue.trim():"");//已去除前后空白
					}
				}
				html+=tmptTemp;
			}
			if(this.container){
				if(html)this.container.innerHTML=html;
			}
			return html;
		}
}
