📄 dom_nodes.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML DOM - Nodes</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>XML DOM Nodes</h1>
<a href="dom_intro.asp"><img border="0" src="../images/btn_previous.gif" alt="prev" width="100" height="20" /></a>
<a href="dom_nodetree.asp"><img border="0" src="../images/btn_next.gif" alt="next" width="100" height="20" /></a>
<hr />
<p class="intro">In the DOM, everything in an XML document is a node.</p>
<hr />
<h2>DOM Nodes</h2>
<p>According to the DOM, everything in an XML document is a <b>node</b>.</p>
<p>The DOM says:</p>
<ul>
<li>The
entire document is a document node</li>
<li>Every XML element is an element node</li>
<li>The text in the XML elements are text
nodes</li>
<li>Every attribute is an attribute node</li>
<li>Comments are comment nodes</li>
</ul>
<hr />
<h2>DOM Example</h2>
<p>Look at the following XML file (<a target="_blank" href="books.xml">books.xml</a>):</p>
<table width="100%" border="1" class="ex" cellspacing="0" id="table17">
<tr>
<td>
<pre><?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="children">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="web">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
<book category="web" cover="paperback">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore></pre>
</td>
</tr>
</table>
<p>The root node in the XML above is named <bookstore>. All other nodes in the
document
are contained within <bookstore>.</p>
<p>The root node <bookstore> holds four <book> nodes.</p>
<p>The first <book> node holds four nodes: <title>, <author>, <year>, and
<price>, which contains one text node each, "Everyday Italian", "Giada
De Laurentiis", "2005", and
"30.00".</p>
<hr />
<h2>Text is Always Stored in Text Nodes</h2>
<p>A common error in DOM processing is
to expect an element node to contain text. </p>
<p>However, the text of an element node is stored in a text node.</p>
<p>In this example: <b><year>2005</year></b>, the element node
<year>, holds a
text node with the value "2005". </p>
<p>"2005" is <b>not</b> the value of the <year> element!</p>
<hr />
<a href="dom_intro.asp"><img border="0" src="../images/btn_previous.gif" alt="prev" width="100" height="20" /></a>
<a href="dom_nodetree.asp"><img border="0" src="../images/btn_next.gif" alt="next" width="100" height="20" /></a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -