XML Lab 2 - solutions

XML Lab 2 - solutions - HIT3693 XML Technologies Exercise 2...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: HIT3693 XML Technologies Exercise 2 SOLUTIONS CREATING XML FILES The solutions shown reflect one of many ways of answering the questions. 3 Creating a Well-formed Document: Prolog and Body Prolog <!-- First comment --> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!-- Second comment --> Body Think about what attributes you can add to some of the elements of the file. Alternatively, you may like to change some elements in your solutions to attributes. Answer: <?xml version = "1.0" encoding="UTF-8" standalone="yes"?> <Editor> <Title>Superior XML Editor</Title> <WelcomeMsg>Welcome to XML/DTD editor that will change the way you use XML!</WelcomeMsg> <Introduction> <OuterText position="beforefile" >This editor allows you to take an XML file,</OuterText> <Filename>datafile.xml</Filename> <OuterText position="afterfile" >and add any new element you like to the file. The editor also automatically updates the internal DTD associated with the XML file. You may have up to two attributes for the new element.</OuterText> </Introduction> <Instructions> <Pre-listText> <OuterText position="beforelink" >You use the </OuterText> <Link>Element Input Page</Link> <OuterText position="afterlink" >to provide details about the element, including:</OuterText> </Pre-listText> <InstrList> <Instr instrnum="1" >the name of the element</Instr> <Instr instrnum="2" >the superelement of this element (in other words, which element does the new element nest inside?)</Instr> <Instr instrnum="3" >an attribute and its associated default value</Instr> <Instr instrnum="4" >another attribute and its associated default value</Instr> <Instr instrnum="5" >the element data (in order words, the HIT3693 XML Technologies Exercise 2 Solutions Swinburne University of Technology Faculty of Information and Communication Technologies 2009 2 text found between the new element's start and end tags)</Instr> </InstrList> </Instructions> <Ending>Have fun with the editor!</Ending> </Editor> Try out incorrect combinations of string literal delimiters, for these attributes and note the error message you see in the browser. Answer: You can try out the other combination not shown. <?xml version = "1.0" encoding="UTF-8" standalone="yes"?> <Editor> <Title>Superior XML Editor</Title> <WelcomeMsg>Welcome to XML/DTD editor that will change the way you use XML!</WelcomeMsg> <Introduction> <OuterText position="beforefile ' >This editor allows you to take an XML file,</OuterText> <Filename>datafile.xml</Filename> <OuterText position="afterfile">and add any new element you like...
View Full Document

Page1 / 6

XML Lab 2 - solutions - HIT3693 XML Technologies Exercise 2...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online