Note 8 for XML
Review:
How about Trying to create a Schema and DTD for storslee.xml
Watch & Read:
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.
Namespaces are used to avoid element name conflicts (allows duplication with a minor modification).
All you have to do is create a new naming convention and point to the location that defines the new convention.
example: xmlns:h="http://www.w3.org/TR/html4/" for html namespace
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" />
Data Island: Only Supported by IE!
Embedding XML* inside HTML to create a Data Island (XML embed ed 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
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
Review the following:
W3schools Namespace Link
W3schools Schema Link
W3schools Xpath Link
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 Chap 12 & 13
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.