option explicit function getNodeType(nodeTypeNumber) dim nodeTypeText select case nodeTypeNumber case 1: nodeTypeText = "element" case 2: nodeTypeText = "attribute" case 3: nodeTypeText = "text" case 4: nodeTypeText = "cdataSection" case 5: nodeTypeText = "entityReference" case 6: nodeTypeText = "entity" case 7: nodeTypeText = "processingInstructions" case 8: nodeTypeText = "comment" case 9: nodeTypeText = "document" case 10: nodeTypeText = "documentType" case 11: nodeTypeText = "documentFragment" case 12: nodeTypeText = "notation" end select getNodeType = nodeTypeText end function sub showError showErrorOf objQuest end sub sub showErrorOf(obj) dim strError strError = "Invalid XML document!" & vbNewline & _ "File: " & obj.parseError.url & vbNewline & _ "Line: " & obj.parseError.line & vbNewline & _ " --- Character: " & obj.parseError.linepos & vbNewline & _ "Source Text: " & obj.parseError.srcText & vbNewline & _ "Description: " & obj.parseError.reason sendError strError end sub function returnIf(state, ifTrue, ifFalse) dim returnValue if state then returnValue = ifTrue else returnValue = ifFalse end if returnIf = returnValue end function function trimDoubleSpaces(strng) dim oldString, newString newString = strng do oldString = newString newString = replace(newString, " ", " ") loop until oldString = newString trimDoubleSpaces = newString end function function repeatedReplace(parText, toFind, toReplace) dim text, oldText text = parText do oldText = text text = replace(text, toFind, toReplace) loop until text = oldText repeatedReplace = text end function function numberIntoMinMax(oldNumber, min, max) dim newNumber newNumber = oldNumber if newNumber < min then newNumber = min elseif newNumber > max then newNumber = max end if numberIntoMinMax = newNumber end function sub sendMessage(message) if serverVersion then response.write "

" & message & "

" else msgbox message end if end sub sub sendError(message) if serverVersion then response.write "

" & message & "

" else msgbox message end if end sub function mapPathIf(filePath) dim newFilePath if serverVersion then newFilePath = server.mapPath(filePath) else newFilePath = filePath end if mapPathIf = newFilePath end function function properCase(text) dim newText dim splitted dim i dim thisWord dim singleWord splitted = split(text, " ") newText = "" for i = lbound(splitted) to ubound(splitted) thisWord = splitted(i) if len(thisWord) >= 2 then singleWord = ucase( left(thisWord, 1) ) & mid(thisWord, 2) else singleWord = thisWord end if newText = newText & singleWord & " " next properCase = rtrim(newText) end function Function splitWords(InputText) const chars = ".!?,;:""'()[]{}" dim strReplacedText dim i strReplacedText = inputText For i = 1 To Len(chars) strReplacedText = Trim(Replace(strReplacedText, _ Mid(chars, i, 1), " ")) Next Do While InStr(strReplacedText, " ") strReplacedText = Replace(strReplacedText, " ", " ") Loop splitWords = split(strReplacedText, " ") End Function function getXmlString(xmlString) dim xmlDoc dim isValid if serverVersion then set xmlDoc = server.createObject("Microsoft.XMLDOM") else set xmlDoc = createObject("Microsoft.XMLDOM") end if xmlDoc.async = false xmlDoc.loadXML xmlString isValid = cBool(xmlDoc.parseError.errorCode = 0) if not isValid then showErrorOf xmlDoc end if set getXmlString = xmlDoc end function Function getInnerXml(objXml) Dim child Dim text text = "" For Each child In objXml.childNodes text = text & child.xml Next getInnerXml = text End Function function getWochentag(datum) getWochentag = getWochentagOfIndex(weekday(datum)) end function function verboseWeekday(ofDate) dim strDay select case weekday(ofDate) case 1 strDay = language("sunday", "Sonntag") case 2 strDay = language("monday", "Montag") case 3 strDay = language("tuesday", "Dienstag") case 4 strDay = language("wednesday", "Mittwoch") case 5 strDay = language("thursday", "Donnerstag") case 6 strDay = language("friday", "Freitag") case 7 strDay = language("saturday", "Samstag") end select verboseWeekday = strDay end function function compareStrings(oldStringCheck, stringOriginal) ' return true if first parameter is ' "hello world", "*lo world", "hello wo*", or "*lo wo*" ' and second is "hello world" const wildcard = "*" dim check dim wildcardLeft dim wildcardRight dim stringCheck dim areSame stringCheck = oldStringCheck wildcardLeft = cBool(left(stringCheck, len(wildcard)) = wildcard) wildcardRight = cBool(right(stringCheck, len(wildcard)) = wildcard) if stringCheck = wildcard then areSame = true elseif wildcardLeft or wildcardRight then stringCheck = replace(stringCheck, wildcard, "") set check = new RegExp check.ignoreCase = true if wildcardLeft and wildcardRight then check.pattern = "\B" & stringCheck elseif wildcardLeft then check.pattern = stringCheck & "$" elseif wildcardRight then check.pattern = "^" & stringCheck end if areSame = check.test(stringOriginal) else areSame = lcase(stringCheck) = lcase(stringOriginal) end if compareStrings = cBool(areSame) end function function getXml(xmlPath) dim xmlDoc dim isValid set xmlDoc = server.createObject("Microsoft.XMLDOM") xmlDoc.async = false xmlDoc.load server.mapPath(xmlPath) isValid = cBool(xmlDoc.parseError.errorCode = 0) if not isValid then sendError getXMLError(xmlDoc) end if set getXml = xmlDoc end function function toProperCase(text) dim newText newText = cStr(text) newText = ucase( left(newText, 1) ) & lcase( mid(newText, 2) ) toProperCase = cStr(newText) end function