him

Untitled

him
May 18th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. 5. Questions.
  2. a. Describe the main differences between HTML and XML. Aldo describe its
  3. purpose.
  4. Html är ett markup språk som står för textbaserad design.
  5. Html fokuserar enbart på hemsidor och inget annat, inga aplikationer osv.
  6. Vilket kan bli ett problem om vi vill bygga in något från våra databassystem, därför använder vi xml.
  7. Vi anroppar en server och får informationen skickad till sig i ett format av html koden..
  8. html består av en heldel fördefinerade taggar. Dessa taggar bestämmer vilka inehåll som finns på en sida. vi kan inte definera egna taggar, har vi minsta lilla fel i taggarna så blir det väldigt fel i dokumentet.
  9.  
  10. b. Describe how we can avoid broken XML-files.
  11. Det är viktigt att kontrollera att start och sluttaggarna blir riktiga annars får vi trasiga XML-filer, vilket är riktigt dåligt då det kan replikera felen vidare i databasen.
  12.  
  13. c. Create an example of an XML-file that conforms to the DTD below. Also describe
  14. briefly how you have solved the assignment.
  15.  
  16. <cellphones>
  17. <cellphone modelnr =”1”>
  18. <name>
  19. Iphone
  20. </name>
  21. <color>
  22. White
  23. </color>
  24. <cpu>
  25. Dual-Core
  26. </cpu>
  27. </cellphone>
  28. </cellphones>
  29.  
  30.  
  31. d. Create an example of an XML-file that conforms to the DTD below. Also describe
  32. briefly how you have solved the assignment.
  33. candybag(candy*)>
  34. candy(size, taste+, color)>
  35. size (#PCDATA)>
  36. color (#PCDATA)>
  37. taste (type, comment)>
  38. type (#PCDATA)>
  39. comment (#PCDATA)>
  40. candy name ID #REQUIRED>
  41. taste name ID #REQUIRED>
  42.  
  43.  
  44.  
  45.  
  46.  
  47. <candybag>
  48. <candy name ”Bilar”>
  49. <size>
  50. 1 cm
  51. </size>
  52. <color>
  53. Green
  54. </color>
  55. <taste name ="Päron">
  56. <type>
  57. Sur
  58. </type>
  59. <comment>
  60. För sur
  61. </comment>
  62. </taste>
  63. </candy>
  64. </candybag>
  65.  
  66.  
  67. e. Create a DTD based on the textual description below. Also describe briefly how
  68. you have solved the assignment.
  69. Golfer: a golfer always wears a glove and can have many types of golf equipment.
  70. Golf equipment: has a name, an area of adaptation and belong to the type ”clubs”
  71. or ”golf balls”.
  72. Clubs: Consists of a number and a tatype iron or wood, name and a comment.
  73. Golf Ball: Has a value of distance and spin.
  74.  
  75. <!ELEMENT Golfer(”golf equipment"*, glove+)>
  76. <!ELEMENT glove (#PCDATA)>
  77. <!ELEMENT ”golf equipment"(name, adaption, clubs | ”golf balls”)>
  78. <!ELEMENT name (#PCDATA)>
  79. <!ELEMENT adaptation (#PCDATA)>
  80. <!ELEMENT ”Golf Ball” (”distance value”, spin)>
  81. <!ELEMENT ”distance value” (#PCDATA)>
  82. <!ELEMENT spin (#PCDATA)>
  83. <!ELEMENT Clubs (number, type, comment)
  84. <!ELEMENT number (#PCDATA)>
  85. <!ELEMENT type (iron|wood)>
  86. <!ELEMENT iron (#PCDATA)>
  87. <!ELEMENT wood (#PCDATA)>
  88. <!ELEMENT commet (#PCDATA)>
  89. <!ATTLIST golfedquipment name id #REQUIRED>
  90. <!ATTLIST clubs name id #REQUIRED>
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. <!ELEMENT pizzas (pizza+)>
  99. <!ELEMENT pizza(bottom, ingredient+, extra*)>
  100. <!ELEMENT bottom(#PCDATA)>
  101. <!ELEMENT ingredient (#PCDATA)>
  102. <!ELEMENT extra (#PCDATA)>
  103. <!ATTLIST pizza name id #REQUIRED>
  104.  
  105.  
  106. <!ELEMENT sunglasses (type+)>
  107. <!ELEMENT type (#PCDATA)>
  108. <!ELEMENT nose (Size+)>
  109. <!ELEMENT Size (#PCDATA)>
  110. <!ELEMENT fits EMPTY>
  111. <!ATTLIST sunglasses name #REQUIRED>
  112. <!ATTLIST nose shape #REQUIRED>
  113. <!ATTLIST fits
  114. sunglasses IDREF #required
  115. nose IDREF #required>
  116.  
  117.  
  118. f. Create a DTD based on the textual description below. Also describe briefly how
  119. you have solved the assignment.
  120. 2
  121. Hifi System: a HIFI system has at least a pair of main speakers and and may have
  122. several types of subwoofers.
  123. Main speaker: has a name, a wife acceptance factor and belongs to a type of cone
  124. speakers or a type of electrostats.
  125. Cone speaker: Consists of a material and has a color. Each material has a name
  126. and at least a comment about its quality.
  127. Electrostat: Consists of a size and to the type ESL or ElectroMotion.
  128. Subwoofer: Has a macho factor and a value of max SPL.
  129.  
  130.  
  131. . Create a XML DTD, which respects the XML-file below. Also describe briefly
  132. how you have solved the assignment.
  133. <pizzas>
  134. <pizza name="Roadkill">
  135. <bottom> Mould Bread </bottom>
  136. <ingredient> Squirrel legs </ingredient>
  137. <ingredient> Sneaky Mushroom </ingredient>
  138. <ingredient> Reek Grass </ingredient>
  139. <extra> Dark Red Blood </extra>
  140. </pizza>
  141. <pizza name="Bomby">
  142. <bottom> Cheesy Thick </bottom>
  143. <ingredient> Greasy Drippin Kebab
  144. </ingredient>
  145. <extra> Cheddar Cheese </extra>
  146. </pizza>
  147. </pizzas>
Advertisement
Add Comment
Please, Sign In to add comment