Note 8 for XML

Review:

How about Trying to create a Schema and DTD for storslee.xml

Watch & Read:

Data Island:

Embeding XML* inside HTML to create a Data Island (XML embeded inside HTML)

*Note: XML can not use attributes for Data Islands! (Note: Beware of attributes and multiple elements)

IE allows HTML to use (parse) an XML Tag <xml>!

datasrc="#source-name" (Identify the XML resource to be displayed)

datafld="field-name" (Identify the XML element to be displayed)

You define the element you want to use by using XPath

 

XPath Notation:

XPath gets you to a Node (a point), you can move from that point and then use the info location as a starting point to gather specific information.

You have seven kinds of nodes that you can access:

element attribute text
namespace comment  
processing-instruction document (root)  


The more specific the path to a node the more efficient use of computer resources.

The Syntax for Xpath is similar to DOS for navigating. Xpath Axes and Operators gives you flexibility to travel the document

Using schedule for an example of a Path inside an XML Document.

/FallSchedule/Class/Title

xpath

Document Root vs Root Element (not the same!) Document Node (Starting point for the document)

Define the path and separate it with the elements in the path with a /

// search for the node and start at that point!

@ for Attributes

Path Questions: What is one path to StartTime? What is the path to EndTime

Once you get to the desired node, you can travel backward or forward using AXES

AXES :: notation (example: child::class for schedule would give you Number, Title & DayOfWeek elements)

Ancestor

Parent / (Ancestor for child)

Child

Decedent / (Child of Child)

Sibling (of the Child)

Questions: What is the Children of Fall Schedule? Name the ancestors of Time?

Try it with cd_catalog.xml Answer the following questions (plus give me the path to each!)

What is the sibling of CD, What is the Child of CD. What is the Ancestor of CD.

/Catalog/CD/sibling::COUNTRY (give me the path directly to this element)

Position Functions: position, last, count

Node Functions: name, node (why?) , processing-instruction, comment (not well supported), text

Boolean Functions: true, false, not

Namespaces: Defining the relationships for elements in XML

xslt, xsl, xlink, html are examples of namespaces defined by W3C. You can create your own namespaces.

Thanks W3schools for the great tutorials!!!

Review the following:

HTML namespace in XML and create simple links Example :

You can add interactivity to your XML Document by an HTML namespace and adding the HTML elements.

<html:a href="http://www.asu.edu"> Jon </html:a>

<html:img src="logo.gif" />

Terms you need to Lookup:

namespace, XPath, Boolean Functions, Node Functions, Position Functions, AXES :: notation

Homework:

Review for the quiz, create a DTD and Schema for schedule.xml

Read pg 385-430

Final Step:

Review in your mind everything we covered in class and remember to cover it again before you go to bed so your mind to process this information while you sleep.