Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:53:44+00:00 2026-06-18T08:53:44+00:00

I was reading an ebook and it has following xml code. <?xml version=1.0?> <?xml-stylesheet

  • 0

I was reading an ebook and it has following xml code.

<?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.

problem is when I continue the rest of the reading I thought I have misunderstand what root element is. According to my knoweledge root node is <sonnet> node.

But in the book I find next this

Unlike other nodes, the root node has no parent. It always has at
least one child, the document element. The root node also contains
comments or processing instructions that are outside the document
element. In our sample document, the two processing instructions named
xmlstylesheet and cocoon-process are both children of the root node,
as are the comment that appears before the tag and the
comment that appears after the tag.

accordning to that whole document is considered as root. If so what is ? It is clear that processing instructions and comments are not child of node.

do I minunderstand?

UPdate

<?xml version="1.0"?> 
<Food> 
  <Cateogry> Vegetable</Cateogry>
  <Cateogry> Fruits</Cateogry>
  <Cateogry> other</Cateogry>
</Food>

what is the root element here? isnt it food?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:53:45+00:00Added an answer on June 18, 2026 at 8:53 am

    The root node has no visual manifestation or textual representation. It is a conceptual node that contains everything else in the document. In the example of your document, it would be like this:

    / (root node)
       |-- processing-instruction() xml-stylesheet
       |-- processing-instruction() cocoon-process 
       |-- comment()
       |-- comment()
       |-- sonnet   (document element)
            |-- auth:author
                 |-- last-name
                 |-- ....
            |-- comment()
            |-- title
            |-- lines
                 |-- line
                 |-- line
                 |-- ....
       |-- comment()
       |-- comment()
    

    As shown here, the root node in your example has 2 processing instructions, 4 comments, and 1 element as children.

    This single child element (sonnet) is what’s called the “document element”. It’s also sometimes called the “root element”, but many people like to avoid this term to minimize confusion with the “root node”, since they are two completely separate things.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was reading in Albahari's excellent eBook on threading and came across the following
Reading the JM 18.4 reference software code I stumbled upon the following expression: return
I'm reading an ebook on PHP right now, and the author noted that the
I am a newbie in C++ and I'm reading this ebook called Jumping into
What are some FOSS libraries for reading epub, mobi, pdf, or other eBook formats
Reading the book I found the following: The way of thinking when you model
Reading through more SICP and I'm stuck on exercise 1.3.8 . My code works
I'm looking for open source references for ebook reading applications in Android. Any reader
After reading (nearly) the whole ebook and taking a look at the API i
Reading Java Essentials, 2nd edition, there's a rule called PECS for type safety in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.