Martha's COIN 74 Week 8 Exercises
Day One - Simple XML
SOURCE: Robert D. Cormia's
online text
my comments in blue
Martha's Simple XML
XML is a 'meta language', meaning that it's not really an application like HTML, but a specification, or framework, that allows you to make your own application, like an address book. XML was created from SGML, the Standard, Generalized Markup Language, crated by IBM way back in 1986. XML is used to write and define common applications like RSS - Really Simple Syndication, that many of you use in blogging. Before you read this homework assignment, please note that you need to have a Web browser that has an XML parser built into it. That might be MSIE, version 5.5 or later, or Firefox (Mozilla). If you are using a Macintosh, try Safari, but don't try anything advanced, like stylesheets. You should first look at the infamous address_book.xml file, and if you can view this file, and see all the data brackets, then you are in good shape.
For those of you that know a little about XML already, and want to find out how Dreamweaver 8 (Studio 8) handles XML, please follow this link - http://www.macromedia.com/devnet/dreamweaver/xml.html
YOUR FIRST XML DOCUMENT
In coding XML you will build a simple address book, with 5 or so records, and use a total of 20 elements. It will follow the rules of XML syntax to be well formed. The file is already built, so I'm hoping that you will modify this one, or embark on your own theme. Click on the link to make sure you can see this file in a Web browser (you'll see elements only). If you cannot open the document, make sure you have an XML parser installed. On any current browser, this should not be an issue.
- Your first xml file The first thing that we need to do is create an XML file, save it and the open it in IE5.5 (or IE 6). Use any favorite text editor (BBEdit, Notepad, or even Dreamweaver) to type your xml document. In our simple.xml file we will type simply change the data for first_name, last_name, email_address, occupation, etc. Make sure to change the data in between the brackets. <first_name> </first_name> and then we save the file. Using your Web browser, next open the file. You should see your changes. In an XML document the file extension of the file needs to be ".xml". After saving the file, go ahead and open it with IE5 (or IE 6), as you would open an HTML file. MSIE is trying to show it understands XML by displaying the tags in color. Change the simple.xml file until it is complete, then upload it to your website, and place a link to it. This is the first of three files that you will build.
- The address_book You will next spend time building out an address book. As with simple.xml, take a look at this file first. Right click (PC) on the file to download it to a folder. Then open it in MSIE (or your XML compliant Web browser) to make sure it is 'tact'. Next open it in your text editor (or Dreamweaver), and make changes to one or more of the records. Fill in all the fields, but keep just one record, to keep the document small and manageable. Edit, save, view, and make sure to keep the file extension as .xml
- Adding more You just saw how simple it was to create and view an XML document without having really talked about any of the specifics yet. In this file, we have made a more elaborate XML document. Sort of. By using copy and paste, and adding records, we've actually started to build out the address_book.xml file. Below, we will explain some of these concepts. As you work through this tutorial, you will find that you already have worked with XML, using well-formed (case sensitive) HTML. SOmetimes we might even call that XHTML, but that's a different story.
COMMENTING
- Comments One of the first concepts a person should learn about a language, is the commenting syntax a language uses. The XML comments should be familiar to you, as it is almost the same as HTML syntax of commenting. (Actually these are SGML comments, as you will read later in your book)
- Except... You can not use "--" inside the comments. If you like to have long lines of comments as easy visual markers,
"<-- -----------SOME INFO--------- -->" you can not use "--" use "=="
instead: "<-- ============SOME INFO=========== -->"
- Some possible alternatives Use any of these commenting lines.
Page Created 11/20/06 Assignment Submitted xx/xx/06
Document Last Modified:
© mjraup 2006
Webmaster