R
Robert Mark Bram
Hi All!
In the code below, I am reading in an xhtml document and attempting to use
selectNodes to find a <p id="rmb"> node..
But the result is:
2 - */*
0 - */p[@id = "rmb"]
Can anyone suggest what I am doing wrong?
Any ideas would be most appreciated!
Rob

====
xmlTest.asp
====
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
var xmlDocument = Server.CreateObject("Msxml2.DOMDocument.3.0");
xmlDocument.async = false;
xmlDocument.setProperty ("ServerHTTPRequest", true);
xmlDocument.setProperty ("SelectionLanguage", "XPath");
var loaded = xmlDocument.load(Server.MapPath("basic.htm"));
if (loaded)
{
var editable = xmlDocument.selectNodes ("*/*");
Response.write (editable.length + " - " + editable.expr + "<br>");
var editable = xmlDocument.selectNodes ("*/p[@id = \"rmb\"]");
Response.write (editable.length + " - " + editable.expr + "<br>");
} // end if
%>
====
basic.htm
====
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Heading</h1>
<p>Body Text</p>
<p id="rmb">Body Text</p>
</body>
</html>
In the code below, I am reading in an xhtml document and attempting to use
selectNodes to find a <p id="rmb"> node..
But the result is:
2 - */*
0 - */p[@id = "rmb"]
Can anyone suggest what I am doing wrong?
Any ideas would be most appreciated!
Rob
====
xmlTest.asp
====
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
var xmlDocument = Server.CreateObject("Msxml2.DOMDocument.3.0");
xmlDocument.async = false;
xmlDocument.setProperty ("ServerHTTPRequest", true);
xmlDocument.setProperty ("SelectionLanguage", "XPath");
var loaded = xmlDocument.load(Server.MapPath("basic.htm"));
if (loaded)
{
var editable = xmlDocument.selectNodes ("*/*");
Response.write (editable.length + " - " + editable.expr + "<br>");
var editable = xmlDocument.selectNodes ("*/p[@id = \"rmb\"]");
Response.write (editable.length + " - " + editable.expr + "<br>");
} // end if
%>
====
basic.htm
====
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Heading</h1>
<p>Body Text</p>
<p id="rmb">Body Text</p>
</body>
</html>