|
|
|
|
eXtensible Markup Language |
|
a way to define your own markup languages with
their own meaningful elements |
|
W3C Recommendation |
|
the future of structured data |
|
|
|
|
need to represent and exchange structured data
on the web |
|
HTML provides minimal structure (H1, H2, DIV, P,
SPAN, etc.) |
|
HTML tag names have little meaning, so it’s hard
to exchange or automatically process data |
|
can’t define your own new tag names in HTML |
|
XML combines the power of SGML with the
simplicity of HTML |
|
|
|
|
provides way to define own markup language (“XML
application”) with its own tag names |
|
tag names can have meaning (PRICE, QUANTITY,
etc.) |
|
says nothing about presentation format of data
(for that, need CSS) |
|
|
|
|
|
case-sensitive |
|
well-formedness constraints (partial list) |
|
every element must have start tag and end tag |
|
elements must be correctly nested |
|
attribute values must be quoted (matching single
or double) |
|
XML parser checks XML document to make sure that
[1] it is well-formed (complies with all w.f. constraints in
specification), and [2] it is valid, meaning the tag names and order
conform to the XML application’s Document Type Definition (DTD)—the definition
of what tags it may have and in what order |
|
|
|
|
<price id=“a238”>23.54</price> |
|
start tag syntax: <name> |
|
attribute-value pairs in start tag |
|
data |
|
end tag syntax: </name> |
|
two examples of empty elements: |
|
<br></br> |
|
<br/> |
|
note special abbreviated syntax of second empty
element |
|
|
|
|
<?xml version="1.0"?> |
|
<item> |
|
<name>Super Widget</name> |
|
<price>25.00</price> |
|
<partnumber>XN-233a</partnumber> |
|
<features> |
|
<woofer/> |
|
<tapeplayer/> |
|
</features> |
|
</item> |
|
|
|
|
Use CSS1 to format your XML documents. |
|
Associating Style Sheets with XML Documents (W3C
Recommendation) |
|
Put a processing instruction in your XML file to
import the style sheet:
<?xml-stylesheet href="mystyle.css"
type="text/css"?> |
|
Put CSS rules in the style sheet file:
Airline {
display: block;
font-style: italic;
} |
|
|
|
|
Different organizations will define their own
DTDs for various purposes. |
|
You may wish to mix elements from more than one
DTD in a single document. |
|
XML Namespaces Recommendation makes this
possible. |
|
For example, you can use HTML elements within an
XML file. |
|
Element names are given a prefix indicating
which application (namespace) they came from. |
|
|
|
|
<?xml version=“1.0”> |
|
<?xml-stylesheet href=“mystyle.css”
type=“text/css”?> |
|
<window
xmlns:html=http://www.w3c.org/TR/REC-html40
xmlns=http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul> |
|
<html:div>Hello, world</html:div> |
|
</window> |
|
|
|
|
an XML application |
|
a W3C Recommendation |
|
provides metadata (information about
information) |
|
shows relationships between items |
|
create labeled directed graphs of nodes which
have attribute/value pairs |
|
can use it to define a data store (such as
bookmarks in Mozilla) |
|
|
|
|
|
full support for XML 1.0 and RDF |
|
James Clark’s expat XML parser |
|
ability to create RDF data stores |
|
support for XML + CSS1 and XML Namespaces |
|
|
|
|
W3C Recommendations at http://www.w3c.org/tr/ |
|
http://dmoz.org/Computers/Data_Formats/Markup_Languages/XML/ |
|
netscape.public.dev.xml |
|
comp.text.xml |
|
netscape.public.dev.rdf |
|
My FAQ:
http://sites.netscape.net/ekrock/answers.html |
|
|
|
|
makes it easier to exchange and process
structured data |
|
makes data on the web usable by software and
applications |
|
enables delivery of structured data to end users |
|