//从文件加载xml
function loadDomDocument(path, callFun)
{
	var xmlData = new ActiveXObject("Msxml2.DOMDocument");
	xmlData.async = false;
	xmlData.load(path);
	if(arguments[1] != null)
	{
		callFun(xmlData);
	}
	return xmlData;
}
//添加CDATA节点
function appendCDATA(xmlDoc, root, strValue)
{
	var cdataNode = xmlDoc.createCDATASection(strValue);
	root.appendChild(cdataNode);
}
//在指定节点上增加一个节点
function appendNode(xmlDoc, root, strNodeName)
{
	var nodeText = "";

	if (arguments.length > 3)
		nodeText = arguments[3];

	var node = xmlDoc.createNode(1, strNodeName, "");
	if (nodeText != "")
		node.text = nodeText;

	root.appendChild(node);

	return node;
}
//在指定节点上增加一个属性
function appendAttr(xmlDoc, node, strAttrName)
{
	var nodeText = "";

	if (arguments.length > 3)
		nodeText = arguments[3];

	var attr = xmlDoc.createAttribute(strAttrName);

	if (nodeText != "")
		attr.value = nodeText;

	node.attributes.setNamedItem(attr);

	return attr;
}
//返回一个节点的属性值，如果没有这个属性，则返回空串
function getAttrValue(node, strAttrName)
{
	var attr = node.attributes.getNamedItem(strAttrName);

	if (attr)
		return attr.value;
	else
		return "";
}
//建立xmlDocument对象
function createDomDocument()
{
	var xmlData = new ActiveXObject("Msxml2.DOMDocument");
	xmlData.async = false;

	if (arguments.length > 0)
		xmlData.loadXML(arguments[0]);

	return xmlData;
}

