Here are the answers
to the CourseWork for Week 4

Nodes

  1. How many nodes does the above document have? 9
  2. How many nodes of the type "Processing instruction" does the above document have? 1
  3. How many comment nodes does the above document have? 1
  4. How many element nodes does the above document have? 4
  5. How many text nodes does the above document have? 2
  6. List the node types that this document does not use.
  7. CDATASection
    Entity Reference
    Entity
    Document Fragment
    Notation

    Node Types, names, and values

  8. What is the nodeType of the 'xdoc' element? 1
  9. What is the nodeName of the 'xdoc' element? xdoc
  10. What is the nodeValue of the 'xdoc' element? null
  11. What is the nodeType of the comment node? 8
  12. What is the nodeName of the comment node? #comment
  13. What is the nodeValue of the comment node? "a simple xml document"
  14. What is the nodeType of the 'Hello XML' node? 3
  15. What is the nodeName of the 'Hello XML' node? #text
  16. What is the nodeValue of the 'Hello XML' node? "Hello HTML!"
  17. What is the nodeType of the first 'greeting' element? 1
  18. What is the nodeName of the first 'greeting' element? greeting
  19. What is the nodeValue of the first 'greeting' element? null
  20. What is the nodeType of the 'applause' element? 2
  21. What is the nodeName of the 'applause' element? type
  22. What is the nodeValue of the 'applause' element? "sustained"
  23. Relationships

    With regard to the first greeting element

  24. What is the parent node? xdoc
  25. What is the first child? text node "Hello HTML!"
  26. What is the last child? text node "Hello HTML!"
  27. What is the next sibling? Second greeting element
  28. What is the previous sibling? null
  29. With regard to the second greeting element

  30. What is the parent node? xdoc
  31. What is the first child? text node "Hello XML!"
  32. What is the last child? text node "Hello XML!"
  33. What is the next sibling? applause element
  34. What is the previous sibling? first greeting element
  35. With regard to the applause element

  36. What is the parent node? xdoc
  37. What is the first child? Attr applause
  38. What is the last child? Attr applause
  39. What is the next sibling? null
  40. What is the previous sibling? Second greeting element
  41. With regard to the xdoc element

  42. What is the parent node? document
  43. What is the first child? first greeting element
  44. What is the last child? applause element
  45. What is the next sibling? null
  46. What is the previous sibling? comment node
  47. With regard to the comment node

  48. What is the parent node? document
  49. What is the first child? null
  50. What is the last child? null
  51. What is the next sibling? xdoc element
  52. What is the previous sibling? processing instructions
  53. Lists.

  54. Make a child list of the xdoc element children and index them.
  55. Make a child list of the first greeting element children and index them.
  56. Make a child list of the applause element children and index them.
  57. Make a list of the second greeting elements and index them.
  58. Make a list of applause elements and index them.
  59. Make a list of the applause attributes and index them.