![]() |
XML crosses the chasm | Table of contents | Indexes | Using the technology | ![]() |
|||
A manager's guide to the latest hot topics |
| Holman, Ken |
| Ken Holman |
| Chief Technology Officer |
Canada ![]() Crane Softwrights Ltd. ![]() Kars ![]() Ontario ![]() | Crane Softwrights Ltd.,
Box 266 Kars Ontario Canada web site: www.CraneSoftwrights.com |
| Biography |
Well-formed XML |
| XML - (Well-formed) Extensible Markup Language |
| A well-formed instance: |
<?xml version="1.0"?> <weather> <current> <temp scale="F">72</temp> <pressure>1005</pressure> <humidity>43</humidity> </current> <min> <temp scale="F">65</temp> <pressure>998</pressure> <humidity>38</humidity> </min> <max> <temp scale="F">78</temp> <pressure>1010</pressure> <humidity>43</humidity> </max> </weather> |
Valid XML |
| XML - (Valid) Extensible Markup Language |
| A valid instance: |
<?xml version="1.0"?> <!DOCTYPE weather [ <!ELEMENT weather ( current, ( min, max )? )> <!ELEMENT current ( temp, pressure, humidity )> <!ELEMENT min ( temp, pressure, humidity )> <!ELEMENT max ( temp, pressure, humidity )> <!ELEMENT temp ( #PCDATA )> <!ATTLIST temp scale ( C | F ) #REQUIRED> <!ELEMENT pressure ( #PCDATA )> <!ELEMENT humidity ( #PCDATA )> ]> <weather> <current> <temp scale="F">72</temp> <pressure>1005</pressure> <humidity>43</humidity> </current> <min> <temp scale="F">65</temp> <pressure>998</pressure> <humidity>38</humidity> </min> <max> <temp scale="F">78</temp> <pressure>1010</pressure> <humidity>43</humidity> </max> </weather> |
XML Schema |
| XML Schema |
| Does not attempt to provide all facilities |
| Part 1: Structures |
| Part 2: Datatypes |
Schematron |
| Schematron |
| A valid XML instance needing Schematron for business rule validation: |
<?xml version="1.0"?> <!DOCTYPE thing [ <!ELEMENT thing ( a | b )> <!ATTLIST thing content ( a | b ) #REQUIRED> <!ELEMENT a (#PCDATA)> <!ELEMENT b (#PCDATA)> ]><thing content="a"><b>test</b></thing> |
|
| Of note: |
Namespaces |
| Vocabulary distinction |
| URI value association |
| The choice of the prefix is arbitrary and can be any lexically valid name |
Extensible HyperText Markup Language (XHTML) |
| Extensible HyperText Markup Language (XHTML) |
Cascading Stylesheets (CSS) |
| Cascading Stylesheets (CSS) |
| Example HTML Specification: |
<html>
<head>
<Title>Test</title>
<style type="text/css">
H1 { color: green; text-align: right }
.info { color: red }
</style>
</head>
<body>
<h1>Test File</h1>
<p class="info">This is a test</p>
</body>
</html>
|
| Example XML Specification: |
| The file samp.css : |
EMPH { color: red; display: inline; font-style:italic }
PARA, TITLE { font-family: arial, sans-serif; display: block }
TITLE { font-weight: bold }
TITLE EMPH { color: blue }
|
| for the file samp.xml : |
<?xml version="1.0"?> <?xml-stylesheet type="text/css" href="samp.css"?> <INFO> <TITLE>Title with <EMPH>emphasis</EMPH></TITLE> <P>This is a paragraph.</P> <P>This has <EMPH>emphasis</EMPH>.</P> <P>Last paragraph</P> </INFO> |
Document Object Model (DOM) |
| Document Object Model (DOM) |
| Example Principles: |
| Example Interface Definition: |
interface Attr : Node {
readonly attribute DOMString name;
readonly attribute boolean specified;
attribute DOMString value;
};
|
| Example Language Binding (Java): |
public interface Attr extends Node {
public String getName();
public boolean getSpecified();
public String getValue();
public void setValue(String value);
}
|
Simple API for XML (SAX) |
| Simple API for XML (SAX) |
| Multiple implementations freely available: |
| Example of events defined in SAX: |
Simple Object Access Protocol (SOAP) |
| Simple Object Access Protocol (SOAP) |
XML Path language (XPath) |
| Addressing identifies a hierarchical position or positions |
| A single W3C recommendation |
| XPath is not a query language |
XSL and XSLT |
| XSL - Extensible Style Language |
| XSLT - XSL Transformations |
| Consider the source file being processed includes a <note> element |
| To produce formatting objects according to XML lexical and syntax rules: |
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:fo="http://www.w3.org/XSL/Format/1.0"> <xsl:import href="main.xsl"/> <xsl:template match="note"> <fo:display-rule/> <fo:block font-posture="italic" font-weight="bold"> <xsl:text>Note: </xsl:text> <xsl:apply-templates/> </fo:block> <fo:display-rule/> </xsl:template> </xsl:stylesheet> |
| To produce HTML according to SGML lexical and syntax conventions: |
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"> <xsl:output method="html"/> <xsl:import href="main.xsl"/> <xsl:template match="note"> <hr/> <p><i><b> <xsl:text>Note: </xsl:text> <xsl:apply-templates/> </b></i></p> <hr/> </xsl:template> </xsl:stylesheet> |
Stylesheet association |
| Relating documents to their stylesheets |
| Ancillary markup |
| Typical examples of use: |
<?xml-stylesheet href="fancy.xsl" type="text/xsl"?> <?xml-stylesheet href="normal.css" type="text/css"?> |
| Less typical examples provided for by the design: |
<?xml-stylesheet alternate="yes" title="small" href="small.xsl" type="text/xsl"?> |
<?xml-stylesheet href="#style1" type="text/xsl"?> |
XML pointing and linking languages (XPointer and XLink) |
| Linking describes a relationship: |
| Two W3C recommendations: |
| Two W3C recommendations (cont.): |
| Rich heritage |
| First-class markup |
XML Topic Maps |
| XML Topic Maps |
| Co-existing models of knowledge domains |
| Architecture based: |
| A navigation description document: |
Resource Description Framework (RDF) |
| Resource Description Framework (RDF) |
XML Query |
| XML Query |
XML Signature |
| XML Signature |
Scalable Vector Graphics (SVG) |
| Scalable Vector Graphics (SVG) |
| Basic types of constructs |
| Unlimited application areas: |
| Consider a simple example of polygons: |
<?xml version="1.0"?> <svg width="175" height="145" > <g style="stroke:black; fill:black" > <polygon points=" 5, 50, 5, 81, 12, 64" /> <polygon points=" 5, 45, 41,116, 41, 73" /> <polygon points=" 44, 76, 44,119, 61,115" /> <polygon points=" 46, 73, 75,140,105, 73" /> </g> <g stroke="black" fill="black"> <polygon points="107, 76,106,119, 89,115" /> <polygon points="144, 45,109,116,109, 73" /> <polygon points="145, 41,167, 4,109, 71" /> <polygon points=" 66, 72, 75, 63, 84, 72" /> </g> </svg> |
Mathematical Markup Language (MathML) |
| Mathematical Markup Language (MathML) |
Wireless Application Profile (WAP) |
| Wireless Application Profile (WAP) |
![]() |
XML crosses the chasm | Table of contents | Indexes | Using the technology | ![]() | |||