Java Reference
In-Depth Information
Element: code-inline, code-inline, null, null
Element: body, body, null, null
Each
Element
-prefixedlineoutputsthenodename,followedbythelocalname,fol-
lowed by the namespace prefix, followed by the namespace URI. The node and local
names are identical because namespaces are not being used. For the same reason, the
namespace prefix and namespace URI are
null
.
Continuing, execute
java DOMDemo recipe.xml
, where
recipe.xml
con-
tains the content shown in
Listing 10-5
. This time, you observe the following output,
which includes namespace information:
Version = 1.0
Encoding = null
Standalone = false
Element: h:html, html, h, http://www.w3.org/1999/xhtml
Attribute xmlns:h = http://www.w3.org/1999/xhtml
Attribute xmlns:r = http://www.tutortutor.ca/
Element: h:head, head, h, http://www.w3.org/1999/xhtml
Element: h:title, title, h, http://www.w3.org/1999/xhtml
Element: h:body, body, h, http://www.w3.org/1999/xhtml
Element: r:recipe, recipe, r, http://www.tutortutor.ca/
Element: r:title, title, r, http://www.tutortutor.ca/
Element:
r:ingredients,
ingredients,
r,
ht-
tp://www.tutortutor.ca/
Element: h:ul, ul, h, http://www.w3.org/1999/xhtml
Element: h:li, li, h, http://www.w3.org/1999/xhtml
Element:
r:ingredient,
ingredient,
r,
ht-
tp://www.tutortutor.ca/
Attribute qty = 2
Element: h:li, li, h, http://www.w3.org/1999/xhtml
Element:
r:ingredient,
ingredient,
r,
ht-
tp://www.tutortutor.ca/
Element: h:li, li, h, http://www.w3.org/1999/xhtml
Element:
r:ingredient,
ingredient,
r,
ht-
tp://www.tutortutor.ca/
Attribute qty = 2
Element: h:p, p, h, http://www.w3.org/1999/xhtml