|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
XMLDOM and ASP problem.
I am currently working on an XML project. in the XML file there are multiple nodes of the same ID so i use objDoc.SelectNodes() to select some nodes accordign to a criteria .. and my problem is that when i try to transform this resultant variable with objNode.TransformNode(objXLS) it is showing error that the property is not supported...
what should i do now ... i need to select multiple nodes and transform it with an XML file i have made.. PLEASE HELP .... |
|
#2
|
||||
|
||||
|
XMLDOM and ASP problem.
please supply some of ur code so we can have a look and hopefully help you.
__________________
Hope this advise helps. ![]() If so please show your appreciation by adding reputation points (click gauge image on top right of this post and score).
|
|
#3
|
|||
|
|||
|
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%Option Explicit%>
<%
Response.Buffer = True
If (Request.Form("mode")="C") Then
'Declare local variables
Dim objXML
Dim objNode
Dim objXSL
Dim objRoot
Dim objRoot2
Dim objNew
Dim objText
Dim html_file
Dim fs_html
'Instantiate the XMLDOM Object that will hold the XML file.
set objXML = Server.CreateObject("Microsoft.XMLDOM")
'Turn off asyncronous file loading.
objXML.async = false
'Instantiate the XMLDOM Object that will hold the XML file.
'Load the XML file.
objXML.load(Server.MapPath("marks.xml"))
'Setting the document root so that that can be dynamically accessed.
'Using the documentElement property of XMLDOM
Set objRoot = objXML.documentElement
'Get the XML record that you wish to view by calling the
'SelectSingleNode method and passing in the e-mail address of the
'contact.
Set objNode = objRoot.selectNodes("FIRSTTERM_row[studentmaster_regno="& trim(Request.Form("adno")) &"][studentname='"& trim(Request.Form("name")) &"']")
'Checking for errors.
If(objNode.length = 0) Then
Response.Write("ERROR : WRONG STUDENT NAME OR ADMISSION NUMBER!")
Response.End()
End If
'Checking over for the Node ...
'Storing values for the node processing...
Dim obj_TEMP
Dim card_data
Dim node_length
'Storing length of node for processing
node_length = objNode.length
Set objTEMP = objNode.selectSingleNode("/FIRSTTERM_row")
'Initialising
'Instantiate the XMLDOM Object that will hold the XSL file.
set objXSL = Server.CreateObject("Microsoft.XMLDOM")
'Turn off asyncronous file loading.
objXSL.async = false
'Load the XSL file.
objXSL.load(Server.MapPath("marks1.xsl"))
card_data = objTEMP.transformNode(objXSL)
card_data = card_data & "<tr><td bgcolor=""#DBF2FD""><strong>Subject Name</strong></td><td bgcolor=""#DBF2FD""><strong>Max Marks</strong></td><td bgcolor=""#DBF2FD""><strong>Min Marks</strong></td><td bgcolor=""#DBF2FD""><strong>Obtained Marks </strong></td><td bgcolor=""#DBF2FD""><strong>Attendance Status **</strong></td></tr>"
For i = 1 to node_length
Set objTEMP = objNode.selectSingleNode("/FIRSTTERM_row("&(node_length-1)&")")
objXSL.load(Server.MapPath("marks2.xsl"))
card_data = card_data & objTEMP.transformNode(objXSL)
objNode = objNode.nextNode()
Next
Set objTEMP = objNode.selectSingleNode("/FIRSTTERM_row")
objXSL.load(Server.MapPath("marks3.xsl"))
card_data = card_data & objTEMP.transformNode(objXSL)
'Transforming the XML data into XHTML using XSL.
Response.Write(card_data)
'After all the work lets have some peace of mind by stopping the processing
Response.End()
End If
'objNode.transformNode(objXSL)
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>LOGIN</title>
<script language="javascript" type="text/javascript">
<!--
function chkform(){ //Fungtion Ensures Form is not submitted invalid
var errorMsg = "";
if (document.login.name.value == "") errorMsg += "Student Name cannot be left blank!\n";
if (document.login.adno.value == "") errorMsg += "Student Admission number cannot be left blank!\n";
if (errorMsg != ""){
alert("ERRORS!\n\t"+errorMsg);
return false;}
return true; }
//-->
</script>
</head>
<body>
<form action="login.asp" method="post" name="login" target="_parent" id="login" onSubmit="return chkform()">
<table width="75%" align="center" >
<caption>
Login
</caption>
<tr>
<td>Student Name </td>
<td><input name="name" type="text" id="name" maxlength="50">
</td>
</tr>
<tr>
<td>Admission Number </td>
<td><input name="adno" type="text" id="adno" maxlength="50"></td>
</tr>
<tr>
<td><input name="mode" type="hidden" id="mode" value="C">
Note: Student Name is case sensitive </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
|
|
#4
|
||||
|
||||
|
Try to use
Code:
strXMLFromXSL = objDOMDocument.transformNode(objXSL.documentElemen t) Collect this string in card_data.. Hope this helps.. |
|
#5
|
||||
|
||||
|
in theory, XML can't have more than one item with the same ID. it's illegal, and
not considered XML... so you might consider using FSO to read the file, being text file only. |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > XMLDOM and ASP problem. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|