<% function getXml(parXmlPath) dim xmlDoc dim isValid dim isMappedPath dim xmlPath set xmlDoc = server.createObject("Microsoft.XMLDOM") xmlDoc.async = false xmlPath = parXmlPath isMappedPath = instr(xmlPath, "\") >= 1 or instr(xmlPath, ":") >= 1 if isMappedPath then xmlPath = parXmlPath else xmlPath = server.mapPath(parXmlPath) end if xmlDoc.load xmlPath isValid = cBool(xmlDoc.parseError.errorCode = 0) if not isValid then sendError getXMLErrorOptionalInfo(xmlDoc, xmlPath) end if set getXml = xmlDoc end function function getXmlString(xmlString) dim xmlDoc dim isValid set xmlDoc = server.createObject("Microsoft.XMLDOM") xmlDoc.async = false xmlDoc.loadXML xmlString isValid = cBool(xmlDoc.parseError.errorCode = 0) if not isValid then sendError getXMLErrorOptionalInfo(xmlDoc, "String") end if set getXmlString = xmlDoc end function function getXMLError(xmlDoc) getXMLError = getXMLErrorOptionalInfo(xmlDoc, "") end function function getXMLErrorOptionalInfo(xmlDoc, info) dim strError strError = "Invalid XML document!" & vbNewline & _ "File: " & xmlDoc.parseError.url & vbNewline & _ "Line: " & xmlDoc.parseError.line & vbNewline & _ "Character: " & xmlDoc.parseError.linepos & vbNewline & _ "Source Text: " & xmlDoc.parseError.srcText & vbNewline & _ "Description: " & xmlDoc.parseError.reason if info <> "" then strError = strError & vbNewline & "[" & info & "]" end if getXMLErrorOptionalInfo = strError end function function xmlToText(xml) dim text text = xml text = replace(text, "&", "&") text = replace(text, "<", "<") text = replace(text, ">", ">") xmlToText = text end function function getAttributeString(element, attributeName) dim returnValue dim attribute returnValue = "" if not (element is nothing) then attribute = element.getAttribute(attributeName) if not isNull(attribute) then returnValue = attribute end if end if getAttributeString = cStr(returnValue) end function function getAttributeBoolean(element, attributeName) dim returnValue dim attribute attribute = element.getAttribute(attributeName) if isNull(attribute) then returnValue = false else returnValue = (attribute = "true") end if getAttributeBoolean = cBool(returnValue) end function function getAttributeDate(element, attributeName) dim returnValue dim attribute attribute = element.getAttribute(attributeName) if isNull(attribute) then returnValue = "" else returnValue = cDate(attribute) end if getAttributeDate = returnValue end function sub sendError(errorString) response.write errorString end sub %>