Problem accessing the XML from the server

wxdqz

New Member
I have a measurement converter that is xml based.Basically, I have an HTML with VB and Java scripts that talks to an xml filethat contains all the metrics name and units.Somehow, my program works fine when I open it from my local drive.But when I try and open it on the server like:http://wwc1/Converter/conversion.htmlIt will not populate the information from the xml file.All is shown is empty text boxs.That is how I call my xml file(here also a segment of my code):<script language="vbscript">' Global variablesXML_FILE_PATH = "conversion.xml"dim xObjXMLLoaded = falseXMLTree = 0function Go()' Start running a conversion' Grab all form valuesDataGroupString = document.conversionform.unitgroup.valueDataFromString = document.conversionform.fromname.valueDataToString = document.conversionform.toname.valueDataAmountString = document.conversionform.amount.value' Use Default value of 1if Trim(DataAmountString) = "" then DataAmountstring = 1' Run conversion and set results boxesdocument.conversionform.left.value = DataAmountString & " " & DataFromStringdocument.conversionform.right.value = DoConversion(DataGroupString,DataAmountString, DataFromString, DataToString) &" " & DataToStringend functionfunction ChangeGroup()' Clears and repopulates "to" and "from" boxes based on unitgroup changeDataGroupString = document.conversionform.unitgroup.valueClearBox()UnitSet = GetUnitList(DataGroupString)for J = 0 to UBound(UnitSet)AddToBox UnitSet(J), DataGroupStringnextend functionfunction LoadBaseGroup()' This is run only once and populates the unit group boxGroupSet = GetUnitGroupList()for I = 0 to UBound(GroupSet)AddToTopBox(GroupSet(I))nextChangeGroup()end functionfunction DoConversion(UnitGroup, Value, FromString, ToString)' This function actually runs the conversionif not XMLLoaded then' Don't re-parse the xml if not neededset XMLTree = CreateObject("Microsoft.xmldom")XMLTree.load(XML_FILE_PATH)XMLLoaded = trueend if' At this point the xml file has been loadedHaveFrom = falseHaveTo = false' Control variablesset CategorySet = XMLTree.documentElement.selectNodes("//unitgroup")for Each Category in CategorySet' Check each unitgroup for the current onefor each Attribute in Category.attributesif Attribute.nodeName = "name" and trim(lcase(Attribute.nodeValue))= trim(lcase(Unitgroup)) then' Found the correct unitgroupset UnitSet = Category.selectNodes("unit")for each Unit in UnitSet' Check each unit for the "from" and "to" unitsfor each SubAttribute in Unit.attributesif SubAttribute.nodeName = "name" and trim(lcase(SubAttribute.nodeValue))= trim(lcase(FromString)) then' Found "From"set FromTag = UnitHaveFrom = trueend ifif SubAttribute.nodeName = "name" and trim(lcase(SubAttribute.nodeValue))= trim(lcase(ToString)) then' Found "To"set ToTag = UnitHaveTo = trueend ifnextnextend ifnextnextif HaveFrom and HaveTo then' Both were foundScale = 1Offset = 0for each Attribute in FromTag.attributes' Conversion to the base unitif Attribute.nodeName = "scaleN" thenScale = Scale / Attribute.nodeValueelseif Attribute.nodeName = "scaleD" thenScale = Scale * Attribute.nodeValueelseif Attribute.nodeName = "offset" thenOffset = Offset + Attribute.nodeValueend ifnextNewValue = Scale * (Value - Offset)Scale = 1Offset = 0for each Attribute in ToTag.attributes' Conversion from the base unit to this oneif Attribute.nodeName = "scaleN" thenScale = Scale * Attribute.nodeValueelseif Attribute.nodeName = "scaleD" thenScale = Scale / Attribute.nodeValueelseif Attribute.nodeName = "offset" thenOffset = Offset + Attribute.nodeValueend ifnextNewValue = Scale * NewValue + OffsetDoConversion = NewValueelse' Oops, unit not foundDoConversion = "[Error]"end ifend functionPLEASE ADVISE.Thank you,Amr
 
Back
Top