Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 5. Questions.
- a. Describe the main differences between HTML and XML. Aldo describe its
- purpose.
- Html är ett markup språk som står för textbaserad design.
- Html fokuserar enbart på hemsidor och inget annat, inga aplikationer osv.
- Vilket kan bli ett problem om vi vill bygga in något från våra databassystem, därför använder vi xml.
- Vi anroppar en server och får informationen skickad till sig i ett format av html koden..
- 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.
- b. Describe how we can avoid broken XML-files.
- 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.
- c. Create an example of an XML-file that conforms to the DTD below. Also describe
- briefly how you have solved the assignment.
- <cellphones>
- <cellphone modelnr =”1”>
- <name>
- Iphone
- </name>
- <color>
- White
- </color>
- <cpu>
- Dual-Core
- </cpu>
- </cellphone>
- </cellphones>
- d. Create an example of an XML-file that conforms to the DTD below. Also describe
- briefly how you have solved the assignment.
- candybag(candy*)>
- candy(size, taste+, color)>
- size (#PCDATA)>
- color (#PCDATA)>
- taste (type, comment)>
- type (#PCDATA)>
- comment (#PCDATA)>
- candy name ID #REQUIRED>
- taste name ID #REQUIRED>
- <candybag>
- <candy name ”Bilar”>
- <size>
- 1 cm
- </size>
- <color>
- Green
- </color>
- <taste name ="Päron">
- <type>
- Sur
- </type>
- <comment>
- För sur
- </comment>
- </taste>
- </candy>
- </candybag>
- e. Create a DTD based on the textual description below. Also describe briefly how
- you have solved the assignment.
- Golfer: a golfer always wears a glove and can have many types of golf equipment.
- Golf equipment: has a name, an area of adaptation and belong to the type ”clubs”
- or ”golf balls”.
- Clubs: Consists of a number and a tatype iron or wood, name and a comment.
- Golf Ball: Has a value of distance and spin.
- <!ELEMENT Golfer(”golf equipment"*, glove+)>
- <!ELEMENT glove (#PCDATA)>
- <!ELEMENT ”golf equipment"(name, adaption, clubs | ”golf balls”)>
- <!ELEMENT name (#PCDATA)>
- <!ELEMENT adaptation (#PCDATA)>
- <!ELEMENT ”Golf Ball” (”distance value”, spin)>
- <!ELEMENT ”distance value” (#PCDATA)>
- <!ELEMENT spin (#PCDATA)>
- <!ELEMENT Clubs (number, type, comment)
- <!ELEMENT number (#PCDATA)>
- <!ELEMENT type (iron|wood)>
- <!ELEMENT iron (#PCDATA)>
- <!ELEMENT wood (#PCDATA)>
- <!ELEMENT commet (#PCDATA)>
- <!ATTLIST golfedquipment name id #REQUIRED>
- <!ATTLIST clubs name id #REQUIRED>
- <!ELEMENT pizzas (pizza+)>
- <!ELEMENT pizza(bottom, ingredient+, extra*)>
- <!ELEMENT bottom(#PCDATA)>
- <!ELEMENT ingredient (#PCDATA)>
- <!ELEMENT extra (#PCDATA)>
- <!ATTLIST pizza name id #REQUIRED>
- <!ELEMENT sunglasses (type+)>
- <!ELEMENT type (#PCDATA)>
- <!ELEMENT nose (Size+)>
- <!ELEMENT Size (#PCDATA)>
- <!ELEMENT fits EMPTY>
- <!ATTLIST sunglasses name #REQUIRED>
- <!ATTLIST nose shape #REQUIRED>
- <!ATTLIST fits
- sunglasses IDREF #required
- nose IDREF #required>
- f. Create a DTD based on the textual description below. Also describe briefly how
- you have solved the assignment.
- 2
- Hifi System: a HIFI system has at least a pair of main speakers and and may have
- several types of subwoofers.
- Main speaker: has a name, a wife acceptance factor and belongs to a type of cone
- speakers or a type of electrostats.
- Cone speaker: Consists of a material and has a color. Each material has a name
- and at least a comment about its quality.
- Electrostat: Consists of a size and to the type ESL or ElectroMotion.
- Subwoofer: Has a macho factor and a value of max SPL.
- . Create a XML DTD, which respects the XML-file below. Also describe briefly
- how you have solved the assignment.
- <pizzas>
- <pizza name="Roadkill">
- <bottom> Mould Bread </bottom>
- <ingredient> Squirrel legs </ingredient>
- <ingredient> Sneaky Mushroom </ingredient>
- <ingredient> Reek Grass </ingredient>
- <extra> Dark Red Blood </extra>
- </pizza>
- <pizza name="Bomby">
- <bottom> Cheesy Thick </bottom>
- <ingredient> Greasy Drippin Kebab
- </ingredient>
- <extra> Cheddar Cheese </extra>
- </pizza>
- </pizzas>
Advertisement
Add Comment
Please, Sign In to add comment