Review of XML and HTML Foundation Materials for

  • Slides: 18
Download presentation
Review of XML and HTML Foundation Materials for XRX Date: 9/30/2008 M D Metadata

Review of XML and HTML Foundation Materials for XRX Date: 9/30/2008 M D Metadata Solutions Dan Mc. Creary President Dan Mc. Creary & Associates dan@danmccreary. co Copyright 2008 Dan Mc. Crearym & Associates 1

Overview • XML file structure – tags – elements – attributes • HTML –

Overview • XML file structure – tags – elements – attributes • HTML – HTML document structure – lists – tables M D Copyright 2008 Dan Mc. Creary & Associates 2

XML is a Hierarchical Data Structure root branch 1 leaf branch 2 branch 3

XML is a Hierarchical Data Structure root branch 1 leaf branch 2 branch 3 leaf branch 4 leaf branch 5 leaf M D Copyright 2008 Dan Mc. Creary & Associates 3

XML Example <root> <branch 1> <leaf>data</leaf> <branch 3> <left>data</left> </branch 3> </branch 1> <branch

XML Example <root> <branch 1> <leaf>data</leaf> <branch 3> <left>data</left> </branch 3> </branch 1> <branch 2> <leaf>data</leaf> <branch 4> <branch 5> <leaf>data</leaf> </branch 4> </branch 2> </root> M D Copyright 2008 Dan Mc. Creary & Associates 4

uniform Tables, Trees and Graphs ht ml non-uniform head N body h 1 Tables

uniform Tables, Trees and Graphs ht ml non-uniform head N body h 1 Tables Simple lists Excel RDBMS Query Language SQL M D A p N a A A N A Trees HTML XML Requirements Taxonomies Simple Concept Maps Directed Graph SKOS RDF OWL Ontologies Query Language XPath/XQuery Language SPARQL N Copyright 2008 Dan Mc. Creary & Associates N 5

Three Ways to Represent Data Tables Trees Graphs • XML is about tree structures

Three Ways to Represent Data Tables Trees Graphs • XML is about tree structures • Arboreal analogies are as abundant as as “trees in the rainforest” M D Copyright 2008 Dan Mc. Creary & Associates 6

Basics of XML Header (Processing Instruction <? xml version="1. 0"? > <Person> <First. Name>John</First.

Basics of XML Header (Processing Instruction <? xml version="1. 0"? > <Person> <First. Name>John</First. Name> <Last. Name>Doe</Last. Name> </Person> M D Exercise • Open Notepad • Add the text to the left • Save as test. xml • Open file with web browser – (Files of type: All Files) • What do you see? • What do the colors tell you? • What happens when you click on the "+" sign? Copyright 2008 Dan Mc. Creary & Associates 7

XML Elements and Tags Start Tag <Name> Data Here </Name> End Tag Element •

XML Elements and Tags Start Tag <Name> Data Here </Name> End Tag Element • Tags surrounded by angle brackets • Elements begin with a Start Tag • Elements end with an End Tag that starts with a “/” • Data between tags • Tags can not begin with a number or contain spaces • Data can contain any amount of white space M D Copyright 2008 Dan Mc. Creary & Associates 8

Attributes <root> <element attr 1="foo" attr 2="bar"/> </root> • Attributes are nested within the

Attributes <root> <element attr 1="foo" attr 2="bar"/> </root> • Attributes are nested within the begin tag • You can only have a single attribute name within an element • Attributes can not be nested • Attributes are not as flexible as elements and are not used in many federal standards M D Copyright 2008 Dan Mc. Creary & Associates 9

Easy to View With Web Browser Open/Close button M D • Web browsers will

Easy to View With Web Browser Open/Close button M D • Web browsers will “recognizes” XML syntax • XML Header Processing Instruction <? . . ? > is in blue • Angle brackets, equals, quotes and backslashes in blue • Tags and attributes in red • Actual data is in black Copyright 2008 Dan Mc. Creary & Associates 10

Element Tree is Created Person First. Name=John M D Last. Name=Doe • Each node

Element Tree is Created Person First. Name=John M D Last. Name=Doe • Each node is called an “element” • Elements are linked in hierarchies • Every tree has one and only one root element Copyright 2008 Dan Mc. Creary & Associates 11

Well Formed, Conform and Valid • If a document is well formed, it meets

Well Formed, Conform and Valid • If a document is well formed, it meets the syntactical rules of the XML language – – Has an appropriate XML header Has a single root element Matching tags: <tag> </tag> Nesting • If an XML document conforms with the content model defined by an XML Schema, it is said to be valid with respect to that Schema – It follows all rules defined by the Schema M D Copyright 2008 Dan Mc. Creary & Associates 12

HTML Example <html xmlns="http: //www. w 3. org/1999/xhtml"> <head> <title>Title</title> </head> <body> <h 1>Document

HTML Example <html xmlns="http: //www. w 3. org/1999/xhtml"> <head> <title>Title</title> </head> <body> <h 1>Document Header</h 1> <p>This is the text of a paragraph. We can add <b>bold</b> or <i>italic</i> markup anywhere in the text. </p> </body> </html> M D Copyright 2008 Dan Mc. Creary & Associates 13

Unordered List <html xmlns="http: //www. w 3. org/1999/xhtml"> <head> <title>Unordered List</title> </head> <body> <h

Unordered List <html xmlns="http: //www. w 3. org/1999/xhtml"> <head> <title>Unordered List</title> </head> <body> <h 1>Demonstration of an unordered list. </h 1> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> </body> </html> Output M D Copyright 2008 Dan Mc. Creary & Associates 14

Ordered List <html xmlns="http: //www. w 3. org/1999/xhtml"> <head> <title>Ordered List</title> </head> <body> <h

Ordered List <html xmlns="http: //www. w 3. org/1999/xhtml"> <head> <title>Ordered List</title> </head> <body> <h 1>Demonstration of an ordered list. </h 1> <ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ol> </body> </html> Output M D Copyright 2008 Dan Mc. Creary & Associates 15

HTML Table <table border="1"> <tr> Start of New Table Row <td>Name</td> Table Data <td>Phone</td>

HTML Table <table border="1"> <tr> Start of New Table Row <td>Name</td> Table Data <td>Phone</td> </tr> Start of Second Row <tr> <td>John Doe</td> <td>123 -4567</td> </tr> </table> Start of Table Output M D Copyright 2008 Dan Mc. Creary & Associates 16

HTML Table With Header and Body Table Header Table Body M D <table> <thead>

HTML Table With Header and Body Table Header Table Body M D <table> <thead> <tr> <th>Col 1 Header</th> <th>Col 2 Header</th> </tr> </thead> <tbody> <tr> <td>row 1 col 1</td> <td>row 1 col 2</td> </tr> <td>row 2 col 1</td> <td>row 2 col 2</td> </tr> </tbody> </table> Copyright 2008 Dan Mc. Creary & Associates Output 17

Thank You! Please contact me for more information: • • • Native XML Databases

Thank You! Please contact me for more information: • • • Native XML Databases Metadata Management Metadata Registries Service Oriented Architectures Business Intelligence and Data Warehouse Semantic Web Dan Mc. Creary, President Dan Mc. Creary & Associates Metadata Strategy Development dan@danmccreary. com (952) 931 -9198 M D Copyright 2008 Dan Mc. Creary & Associates 18