私は電子ブックを読んでいましたが、次のxmlコードがあります。
<?xml version="1.0"?>
<?xml-stylesheet href="sonnet.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<!DOCTYPE sonnet [
<!ELEMENT sonnet (auth:author, title, lines)>
<!ATTLIST sonnet public-domain CDATA "yes"
type (Shakespearean | Petrarchan) "Shakespearean">
<!ELEMENT auth:author (last-name,first-name,nationality,
year-of-birth?,year-of-death?)>
<!ELEMENT last-name (#PCDATA)>
<!ELEMENT first-name (#PCDATA)>
<!ELEMENT nationality (#PCDATA)>
<!ELEMENT year-of-birth (#PCDATA)>
<!ELEMENT year-of-death (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT lines (line,line,line,line,
line,line,line,line,line,line,line,
line,line,line)>
<!ELEMENT line (#PCDATA)>
]>
<!-- Default sonnet type is Shakespearean, the other allowable -->
<!-- type is "Petrarchan." -->
<sonnet type="Shakespearean">
<auth:author xmlns:auth="http://www.authors.com/">
<last-name>Shakespeare</last-name>
<first-name>William</first-name>
<nationality>British</nationality>
<year-of-birth>1564</year-of-birth>
<year-of-death>1616</year-of-death>
</auth:author>
<!-- Is there an official title for this sonnet? They're
sometimes named after the first line. -->
<title>Sonnet 130</title>
<lines>
<line>My mistress' eyes are nothing like the sun,</line>
<line>Coral is far more red than her lips red.</line>
<line>If snow be white, why then her breasts are dun,</line>
<line>If hairs be wires, black wires grow on her head.</line>
<line>I have seen roses damasked, red and white,</line>
<line>But no such roses see I in her cheeks.</line>
<line>And in some perfumes is there more delight</line>
<line>Than in the breath that from my mistress reeks.</line>
<line>I love to hear her speak, yet well I know</line>
<line>That music hath a far more pleasing sound.</line>
<line>I grant I never saw a goddess go,</line>
<line>My mistress when she walks, treads on the ground.</line>
<line>And yet, by Heaven, I think my love as rare</line>
<line>As any she belied with false compare.</line>
</lines>
</sonnet>
<!-- The title of Sting's 1987 album "Nothing like the sun" is -->
<!-- from line 1 of this sonnet.
問題は、残りの読書を続けるときに、ルート要素とは何かを誤解していると思ったことです。私の知識によると、ルートノードは<sonnet>
ノードです。
しかし、次の本の中でこれを見つける
他のノードとは異なり、ルート ノードには親がありません。これには常に少なくとも 1 つの子である document 要素があります。ルート ノードには、ドキュメント要素の外部にあるコメントまたは処理命令も含まれます。このサンプル ドキュメントでは、xmlstylesheet と cocoon-process という名前の 2 つの処理命令は、タグの前に表示されるコメントとタグの後に表示されるコメントと同様に、両方ともルート ノードの子です。
そのドキュメント全体によると、ルートと見なされます。もしそうなら、何ですか?処理命令とコメントがノードの子でないことは明らかです。
私は理解していますか?
アップデート
<?xml version="1.0"?>
<Food>
<Cateogry> Vegetable</Cateogry>
<Cateogry> Fruits</Cateogry>
<Cateogry> other</Cateogry>
</Food>
ここでルート要素は何ですか?食べ物じゃない?