Dale face
Home
Journal Pages
Learning:
The Journey of a Lifetime
or
A Cloud Chamber of the Mind

Previous Page

Monday June 18, 2007 5:50 am Lethbridge Sunrise 5:23 Sunset 21:42 Hours of daylight: 16:19

A. Morning Musings

5:50 am It is +6 C with a high forecast of +20 C.

Here are the news.

CBC Headline: Critics raise alarms over Canada's no-fly list

Canada's no-fly list comes into effect Monday as transportation experts and privacy advocates warn that checking domestic airline passengers' names against a list of people deemed to be potential threats could lead to abuses. I agree with the critics who say it will not improve security but it will increase the probability of difficulties for some who are on the list due to a mistake in processing.

Canadian Headline: see above

Australian Headline: (from The Australian): Email reveals 'broadband plan targets marginals'

A leaked email from Communications Minister Helen Coonan shows the government's $1.9 billion broadband plan is targeted at marginal seats held by coalition MPs, Labor says. Politics.

B. Actual/Notes

6:00 am I am continuing my efforts to learn XML, CSS, XHTML.

feather indicating this is a notebook

Technology 24

June 18

Technology Notes


6:05 am I want to step back from CSS for a moment and refresh my mind about the big picture of XML and stylesheets.


Part I Creating XML Documents

Chapter 1 Welcome to XML

Here is a schematic image of what I have covered so far:

XML schematic

Chapter 2 Creating XML Documents

There are 3 types of software tools that one needs to use when working with XML files: text editors, Web browsers and validators. There are many alternatives within each type, but it appears to me that Dreamweaver 8 provides both the first and third tools and provides an easy preview link to the browser of my choice.

There are 7 different parts to a typical XML document:

  • Prologs
  • XML declarations
  • Processing instructions
  • Elements and attributes
  • Comments
  • CDATA sections
  • Entities
This appears to be jargon, but it is essential to learn both the terms (and what they mean). This is the conceptual part of learning XML and is critical to understanding the procedures when one is using Dreamweaver 8.

This diagram shows the 7 topics, organized as they should appear in an XML file:

XML parts

1. XML declarations

An XML declaration is the first line of an XML file. This specifies the version of XML that is being used (use 1.0 rather than 1.1 as most browsers are not yet ready for 1.1).

The declaration should also include the encoding language used for the document. The default is UTF-8. Dreamweaver 8 uses ISO-8859-1.

Here is the first line of an XML file created automatically by Dreamweaver 8:

<?xml version="1.0" encoding="ISO-8859-1"?>

2. Comments

Comments can be inserted at any point in the file to provide additional explanatory or descriptive notes. They are valuable if more than one person is working on the file.

The text inside a comment is ignored by the XML processor.

A comment begins with <!-- and ends with -->

Example:

<!-- This is an example of a comment.-->

Here is an example of a very simple XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<!-- This is an example of a comment. -->
</root>

The file begins with an XML declaration and then has beginning root tag. This is followed by all of the other XML code and ends with an ending root tag. The only actual code so far is a comment statement.

3. Processing Instructions

A processing instruction provides additional information to the XML processor. The commands are processor dependent. For example most browsers recognize the following command as a way of linking a CSS stylesheet to an XML file:

<?xml-stylesheet type="text/css" href="filename.css"?>

This is usually the second line of an XML file and occurs before the root tag.

4. Creating Tags and Elements

A tag is simply a character string enclosed in < >.

A tag name should begin with a letter and is case-sensitive.

Every element should have both a beginning tag and an end tag.

e.g. <tag> ... </tag>

Every XML file should be well-formed. This means that all elements must be contained within a root element, and that the nesting is well-structured.

Example:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="filename.css"?>
<root>
<!-- This is an example of a comment. -->
</root>

An XML attribute is a pair of words, separated by an = symbol. The first word is the name of the attribute and the second word (enclosed in "s) is the value of the attribute.

Example: height="10"

Attributes may occur within elements, XML declarations, and processing instructions.

5. CDATA sections

CDATA stands for character data whereas PCATA stands for parsed character data.

Here is the format for enclosing data that one does not want parsed by the XML processor:

<![CDATA[textual material involving special characters and formatting]]>

6. Entities

An entity is simply a data item such as a section of text or binary data.

Entity references are replaced by the entities they refer to by the XML processor.

Example: " will be replaced by the " symbol.

The material in this chapter covers the basic syntax of an XML file.

However it is also often important to provide information about the nature of the data that is stored within the XML file. This is done by means of a Document Type Definition (DTD) or an XML schema.

Then once one is confident that the XML file contains valid data, one can focus on how to display this data on various devices. This involves the use of Cascading Style Sheets (a CSS file) or other stylesheet conventions (an XSLT file - Extensible Stylesheet Language Transformation)

QUIZ

1. What two character encodings are all XML processors supposed to implement?

UTF-8 and UTF-16

2. If you wanted to include the text data "This is a <message> element" in an element named <message>, how could you do it without confusing an XML processor?

<message>
<![CDATA[This is a <message> element]]>
</message>

3. What items can be contained in an XML prolog?

XML declaration, comments, and processing instructions.

4. What three attributes can appear in an XML declaration?

version, encoding method, standalone

5. What processing instructions are built into XML already?

none

SUMMARY of the session:

8:40 am This took more time than I expected to make the notes. However I am engaging in some genuine learning. I was not familiar with CDATA commands nor entities. I now have a clearer idea of attributes.

I think I also have a much clearer idea of the relationship between an XML file (including the special case of an XHTML file) and a stylesheet file (CSS or XSLT).

The validity of an XML file can be checked using either a Document Type Definition or with an XML schema file.

 

5:00 PM I have just finsihed reading "Bel Canto". I am speechless. Patchett has that rare gift of selecting the right language for the story she wishes to tell. I could hardly put the book down, even when I turned the last page.

C. Plan

Immediate    
Literature Complete reading "Bel Canto" by Ann Patchett
2 hr
Technology Read & make notes for chap 2 of "Teach Yourself XML in 21 Days"
3 hr
Science Read & make notes for "The Canon" by Natalie Angier
1 hr
Later    
Technology Make notes for chap. 4 of "Switching to the Mac"  
  Learn how to attach a digital camera to my spotting scope  
  Burn backup of images onto DVD  
Mathematics Read & make notes on The Humongous Book of Calculus Problems  
  Write a paper on mathematics education  
  Continue reading "Algebra: Abstract and Concrete" by Frederick Goodman  
  Read "Symmetry" by David Wade  
  Make notes for "Mathematics: A Human Endeavor" ch 1  
  Read "Fearless Symmetry" chap 9: Elliptic Curves  
Model Trains Add ground cover to oil refinery diorama  
  Follow tutorial for version 8 of 3rd PlanIt  
  Continue assembly of coaling tower  
  Purchase DCC system  
History Begin reading "Maya"  
  Read Watson "Ideas"  
Philosophy Read & make notes for "Breaking the Spell"  
  Begin reading "How Are We To Live?" by Peter Singer  
Literature New York Times easy crossword puzzles  
GO Complete reading "Lessons in the Fundamentals of Go"  
Puzzles

The Orange Puzzle Cube: puzzle #10

Major Goals    
Learning Review week's pages each Sunday  
  Review all pages for the month at the end of each month  
Technology Review & edit iPhoto files for 2006  
Model Trains Become proficient with 3rd PlanIt software  
  Install DCC on model train layout  
GO Learn to play GO at something better than a beginner level  
Drawing Learn to draw!! (I keep saying this, yet I have yet to put a pencil to paper).  
Mathematics Continue to play with mathematics.  
Literature Continue to read Literature  
Bird Watching Continue to engage in bird watching activities.  

D. Reflection