Asp xml list change

asp xml list change





xml

<?xml version="1.0"?>
<PIP>
<STATE Id="4" Name="California">
<PIPCODE1>
<PLAN PIPplantype="PLAN A">
<MAXMEDEXP Value="20000" Text="20,000" />
<MAXNONMEDEXP Value="20000" Text="20,000" />
<MAXWORKLOSS Value="250" Text="250" /> 
</PLAN>
<PLAN PIPplantype="PLAN B">
<MAXMEDEXP Value="30000" Text="30,000" />
<MAXNONMEDEXP Value="20000" Text="20,000" />
<MAXWORKLOSS Value="250" Text="250" /> 
</PLAN>
<PLAN PIPplantype="PLAN C" >
<MAXMEDEXP Value="40000" Text="40,000" />
<MAXNONMEDEXP Value="20000" Text="20,000" />
<MAXWORKLOSS Value="250" Text="250" /> 
</PLAN>
<PLAN PIPplantype="PLAN D">
<MAXMEDEXP Value="50000" Text="50,000" />
<MAXNONMEDEXP Value="20000" Text="20,000" />
<MAXWORKLOSS Value="250" Text="250" /> 
</PLAN>
<PLAN PIPplantype="PLAN E">
<MAXMEDEXP Value="50000" Text="50,000" />
<MAXNONMEDEXP Value="35000" Text="35,000" />
<MAXWORKLOSS Value="350" Text="350" /> 
</PLAN>
</PIPCODE1>

</STATE>
</PIP>

asp


<%@ language="VBScript" %>


<% 
'Create DOMdocument. Instantiatate the XML Processor
Set objXML = Server.CreateObject("MSXML.DOMDocument") 

if err then
Response.Write "<font color=red><b>2. LU_PIP.asp " & Err.description & "</b><font>"
Response.End 
end if 

'Load the XML Document. Temporary we load it in LU_Gender.xml 
objXML.load(Server.MapPath("test.xml"))

'Assing XML string from DOM Document into XML root node.
Set objRootElement = objXML.documentElement

if err then 
Response.write "<center><font=red><b>4. LU_PIP.asp " & Err.description & "</b></font></center>"
Response.End
end if

err.Clear

Set objStateNode = objRootElement.selectSingleNode("STATE")

Set objPIPCode1 = objStateNode.selectSingleNode("PIPCODE1")
Set objPlan = objPIPCode1.selectSingleNode("PLAN")
Set objMaxMedExp = objPlan.selectSingleNode("MAXMEDEXP")
Set objMaxNonMedExp = objPlan.selectSingleNode("MAXNONMEDEXP")
Set objMaxWorkLoss = objPlan.selectSingleNode("MAXWORKLOSS")

MaxMedExpNode = objMaxMedExp.attributes.getNamedItem("Value").nodeValue
MaxMedExpNodeText = objMaxMedExp.attributes.getNamedItem("Text").nodeValue

MaxNonMedExpNode = objMaxNonMedExp.attributes.getNamedItem("Value").nodeValue
MaxNonMedExpNodeText = objMaxNonMedExp.attributes.getNamedItem("Text").nodeValue

MaxWorkLossNode = objMaxWorkLoss.attributes.getNamedItem("Value").nodeValue
MaxWorkLossNodeText = objMaxWorkLoss.attributes.getNamedItem("Text").nodeValue


%> <html>
<Body>
<table>
<tr>
<td>
Plan Type
</td>
<td>
<select name="plantype">
<% for each objPlan in objPIPCode1.childNodes %> 
<% PIPplantype = objPlan.attributes.getNamedItem("PIPplantype").nodeValue%>
<option value="<%=PIPplantype %>"> <%=PIPplantype%></option>
<%next %>
</select>
</td>

<tr>
<td class="SmallHeadingBurg" width="180"> Medical Expense:&nbsp;</td>
<td class="regularParagraph" align="left">$
<SELECT size=1 id="MaxMedExp" name="MaxMedExp" multiple>
<OPTION value="<%=MaxMedExpNode%>"><%=MaxMedExpNodeText%></OPTION>
</SELECT>
</td>
</tr>
<tr>
<td class="SmallHeadingBurg" width="180">Non-Med Expense:&nbsp;</td>
<td class="regularParagraph" align="left">$
<SELECT size=1 id="MaxNonMedExp" name="MaxNonMedExp" multiple>
<OPTION value="<%=MaxNonMedExpNode%>" ><%=MaxNonMedExpNodeText%></OPTION>
</SELECT>
</td>
</tr>
<tr>
<td class="SmallHeadingBurg" width="180">Work Loss:&nbsp;</td>
<td class="regularParagraph" align="left">$
<SELECT size=1 id="MaxWorkLoss" name="MaxWorkLoss" multiple>
<OPTION value="<%=MaxWorkLossNode%>" ><%=MaxWorkLossNodeText%></OPTION>
</SELECT>
</td>
</tr>


</table>

<%
'Free server resources associated with the instance.
'Set DomDoc = Nothing
Set objXML = Nothing
Set objStateNode = Nothing
Set DataNodes = Nothing
Set objPIPCode1 = Nothing
Set objPlan = Nothing
Set objMaxMedExp = Nothing
Set objMaxNonMedExp = Nothing
Set objMaxWorkLoss = Nothing

Set WorkLossNodes = Nothing
%>
</Body>
</Html>