
function XML(){	
//v1.2
//创建：黄文海
//功能：不管客户端的xml解析器版本如何，都能创建xml dom,xml http对象。
//并且能够返回错误信息。
/*
last modified: 2005-02-03
Created by: hengzhe
Created on:2004-11-03
Function: Create xml dom and xml http object,no matter what version the client machine's 
xml parser is.Also,It can report error,during the process xml document.

Parametes:None
输入参数：无
Return Value: user defined object
返回值：类XML的实例。


Call instance:
		var xml=new XML();
		xml.init(0);
		var xmlDoc=xml.dom;

*/
this.dom=null;
this.http=null;
this.err="";
var flag=0;
//implement method: createDOM
this.createDOM=function(){
try{
//check to see whether the oldest version of xml parser is available.
	this.dom=new ActiveXObject("Msxml2.DOMDocument.4.0");
 //status="4.0";
	}
catch(exception){
	flag=1;
	//status='Your browser does not support XMLDOM!';
	window.top.status='友情提醒：您的浏览器的xml解析器版本过低，建议您安装Microsoft XML 4.0!';
				};
if(flag==1)
	try{
	this.dom=new ActiveXObject("Msxml2.DOMDocument");
	}
	catch(e){
		flag=2;
		window.top.status='友情提醒：您的浏览器的xml解析器版本过低，建议您安装Microsoft XML 4.0!';
	}
if(flag==2)
	try{
	this.dom=new ActiveXObject("Microsoft.XMLDOM");
	}
	catch(e){
		flag=3;
		window.top.status='友情提醒：您的浏览器的不支持xml!建议您安装Microsoft XML 4.0!';
	}	
}
//createDOM
//implement method: createHTTP
this.createHTTP=function(){
 try{
 this.http=new ActiveXObject("Msxml2.XMLHTTP.4.0");
    }
 catch(exception){
	 flag=1;
	 window.top.status='友情提醒：您的浏览器的xml解析器版本过低，建议您安装Microsoft XML 4.0!';
	}
if(flag==1)
	try{
		this.http=new ActiveXObject("Msxml2.XMLHTTP")
	}
	catch(e){
		flag=2;
		window.top.status='友情提醒：您的浏览器的xml解析器版本过低，建议您安装Microsoft XML 4.0!';
	}
if(flag==2)
	try{
		this.http=new ActiveXObject("Microsoft.XMLHTTP")
	}
	catch(e){
		flag=3;
		window.top.status='友情提醒：您的浏览器的不支持xml!\n建议您安装Microsoft XML 4.0!';
	}
}
//createHTTP
//implement method: reportError
this.reportError=function(srcObject,objType){
//Author: hengzhe(黄文海) 2004-09-15
//Function: Report xml related errors.
//Parameters:srcObject--xml dom or http object ;objType: 0--xml dom 1--xml http
var errInfo='错误 XML Parsing Error\''+srcObject.parseError.errorCode+'\'：\n Line: ';
if(objType==0){
  errInfo+=srcObject.parseError.line+'\n Column: '+srcObject.parseError.linepos+'\n Reason: '+srcObject.parseError.reason+'\n消息:'+srcObject.parseError.srcText;
              }
else{
 errInfo+='状态：'+srcObject.window.top.statusText+'\nResponse Text: '+srcObject.responseText+'-^';
    }
 //alert(errInfo);
 this.err=errInfo;
}
//reportError

this.init=function(i){
if(i==0)
	this.createDOM();
	
else
	this.createHTTP();

		}
}
function printError(err){
if(document.all['err']){
	document.all['err'].innerHTML="<hr color='#00FF66'>"+err;
	document.all['err'].style.display='';
}
}

