Java Reference
In-Depth Information
Unliketheotherelements,whichhave
parent elements
,
recipe
hasnoparent.Also,
recipe
and
ingredients
have
child elements
:
recipe
's children are
title
,
ingredients
, and
instructions
; and
ingredients
' children are three in-
stancesof
ingredient
.The
title
,
instructions
,and
ingredient
elements
don't have child elements.
Elements can contain child elements, content, or
mixed content
(a combination of
name
and
language
childelements,andalsorevealsthateachofthesechildelements
anotherexamplethatdemonstratesmixedcontentalongwithchildelementsandcontent.
Listing 10-3.
An
abstract
element containing mixed content
<?xml version="1.0"?>
<article title="the rebirth of javafx" lang="en">
<abstract>
JavaFX 2.0 marks a significant milestone in the his-
tory of JavaFX. Now that
Sun Microsystems has passed the torch to Oracle, we
have seen the demise of
JavaFX Script and the emerge of Java APIs (such as
<code-inline>javafx.application.Application</code-
inline>) for interacting
with this technology. This article introduces you to
this new flavor of
JavaFX, where you learn about JavaFX 2.0 architecture
and key APIs.
</abstract>
<body>
</body>
</article>
This document's root element is
article
, which contains
abstract
and
body
childelements.The
abstract
elementmixescontentwitha
code-inline
element,
which contains content. In contrast, the
body
element is empty.