为什么?Document.documentElement.firstChild.nodeValue的值为NUll?
Document.documentElement.firstChild.nodeValue的值为NUll,代码如下?
我想得到title下在text,不要子节点的text。
<?xml version="1.0"?>
<!-- File Name: Book.xml -->
<BOOK>
<TITLE>The Adventures of Huckleberry Finn<test>this is a test</test></TITLE>
<AUTHOR>Mark Twain</AUTHOR>
<BINDING>mass market paperback</BINDING>
<PAGES>298</PAGES>
<PRICE>$5.49</PRICE>
</BOOK>
<!--This is :domDeom.htm//-->
<html>
<head>
<title>Book Description</title>
<script language="Javascript" for="window" Event="ONLOAD">
Document = dsoBook.XMLDocument;
comment.innerText = document.childNodes(0).text;
title.innerText = Document.documentElement.firstChild.nodeValue;
author.innerText = Document.documentElement.childNodes(1).text.length;
binding.innerText=Document.documentElement.childNodes(2).text;
pages.innerText = Document.documentElement.childNodes(3).text;
price.innerText = Document.documentElement.childNodes(4).text;
</script>
</head>
<body>
<XML ID="dsoBook" SRC="Book.xml"></XML>
<span id="comment"></span><p>
<h2>Book Description</h2>
<span style="font-style:italic">TITLE:</span>
<span id="title" style="font-weight:bold"></span>
<P>
<span style="font-style:italic">AUTHOR:</span>
<span id="author" style="font-weight:bold"></span>
<P>
<span style="font-style:italic">binding:</span>
<span id="binding" style="font-weight:bold"></span>
<P>
<span style="font-style:italic">pages:</span>
<span id="pages" style="font-weight:bold"></span>
<P>
<span style="font-style:italic">price:</span>
<span id="price" style="font-weight:bold"></span>
</body>
</html>