- XML Reference Guide
- Overview
- What Is XML?
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Table of Contents
- The Document Object Model
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- DOM and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Implementations
- DOM and JavaScript
- Using a Repeater
- Repeaters and XML
- Repeater Resources
- DOM and .NET
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Downloads
- DOM and C++
- DOM and C++ Resources
- DOM and Perl
- DOM and Perl Resources
- DOM and PHP
- DOM and PHP Resources
- DOM Level 3
- DOM Level 3 Core
- DOM Level 3 Load and Save
- DOM Level 3 XPath
- DOM Level 3 Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- The Simple API for XML (SAX)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SAX and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- SAX and .NET
- Informit Articles and Sample Chapters
- SAX and Perl
- SAX and Perl Resources
- SAX and PHP
- SAX and PHP Resources
- Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Document Type Definitions (DTDs)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Schemas
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- RELAX NG
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Schematron
- Official Documentation and Implementations
- Validation in Applications
- Informit Articles and Sample Chapters
- Books and e-Books
- XSL Transformations (XSLT)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XSLT in Java
- Java in XSLT Resources
- XSLT and RSS in .NET
- XSLT and RSS in .NET Resources
- XSL-FO
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XPath
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Base
- Informit Articles and Sample Chapters
- Official Documentation
- XHTML
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XHTML 2.0
- Documentation
- Cascading Style Sheets
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XUL
- XUL References
- XML Events
- XML Events Resources
- XML Data Binding
- Informit Articles and Sample Chapters
- Books and e-Books
- Specifications
- Implementations
- XML and Databases
- Informit Articles and Sample Chapters
- Books and e-Books
- Online Resources
- Official Documentation
- SQL Server and FOR XML
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- Service Oriented Architecture
- Web Services
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Creating a Perl Web Service Client
- SOAP::Lite
- Amazon Web Services
- Creating the Movable Type Plug-in
- Perl, Amazon, and Movable Type Resources
- Apache Axis2
- REST
- REST Resources
- SOAP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SOAP and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- WSDL
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- UDDI
- UDDI Resources
- XML-RPC
- XML-RPC in PHP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Ajax
- Asynchronous Javascript
- Client-side XSLT
- SAJAX and PHP
- Ajax Resources
- JSON
- Ruby on Rails
- Creating Objects
- Ruby Basics: Arrays and Other Sundry Bits
- Ruby Basics: Iterators and Persistence
- Starting on the Rails
- Rails and Databases
- Rails: Ajax and Partials
- Rails Resources
- Web Services Security
- Web Services Security Resources
- SAML
- Informit Articles and Sample Chapters
- Books and e-Books
- Specification and Implementation
- XML Digital Signatures
- XML Digital Signatures Resources
- XML Key Management Services
- Resources for XML Key Management Services
- Internationalization
- Resources
- Grid Computing
- Grid Resources
- Web Services Resource Framework
- Web Services Resource Framework Resources
- WS-Addressing
- WS-Addressing Resources
- WS-Notifications
- New Languages: XML in Use
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Google Web Toolkit
- GWT Basic Interactivity
- Google Sitemaps
- Google Sitemaps Resources
- Accessibility
- Web Accessibility
- XML Accessibility
- Accessibility Resources
- The Semantic Web
- Defining a New Ontology
- OWL: Web Ontology Language
- Semantic Web Resources
- Google Base
- Microformats
- StructuredBlogging
- Live Clipboard
- WML
- XHTML-MP
- WML Resources
- Google Web Services
- Google Web Services API
- Google Web Services Resources
- The Yahoo! Web Services Interface
- Yahoo! Web Services and PHP
- Yahoo! Web Services Resources
- eBay REST API
- WordML
- WordML Part 2: Lists
- WordML Part 3: Tables
- WordML Resources
- DocBook
- Articles
- Books and e-Books
- Official Documentation and Implementations
- XML Query
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XForms
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Resource Description Framework (RDF)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Topic Maps
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation, Implementations, and Other Resources
- Rich Site Summary (RSS)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Simple Sharing Extensions (SSE)
- Atom
- Podcasting
- Podcasting Resources
- Scalable Vector Graphics (SVG)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- OPML
- OPML Resources
- Summary
- Projects
- JavaScript TimeTracker: JSON and PHP
- The Javascript Timetracker
- Refactoring to Javascript Objects
- Creating the Yahoo! Widget
- Web Mashup
- Google Maps
- Indeed Mashup
- Mashup Part 3: Putting It All Together
- Additional Resources
- Frequently Asked Questions About XML
- What's XML, and why should I use it?
- What's a well-formed document?
- What's the difference between XML and HTML?
- What's the difference between HTML and XHTML?
- Can I use XML in a browser?
- Should I use elements or attributes for my document?
- What's a namespace?
- Where can I get an XML parser?
- What's the difference between a well-formed document and a valid document?
- What's a validating parser?
- Should I use DOM or SAX for my application?
- How can I stop a SAX parser before it has parsed the entire document?
- 2005 Predictions
- 2006 Predictions
- Nick's Book Picks
One thing about being a developer is that there are always lots of things to keep track of. Maybe its your "to do" list, or a list of items that need to be fixed, or a list of resource materials to keep track of ... notice a pattern here?
It seems like the first step in almost everything I do is to make a list that breaks a large task (or block of information) into something more manageable. More often than not, that involves making an outline.
Now, I don't know whether they're still teaching outlines in school -- I had to explain them to my teenage son this past week -- but they typically involve multiple levels of information, such as:
- Overview
- What is XML?
- Table of Contents
- Programming with XML
- The Document Object Model
- DOM and Java
- DOM and .NET
- Simple API for XML
- SAX and Java
- SAX and .NET
- XML in Use: New Languages
- DocBook
- SVG ...
- Additional Resources
- Frequently Asked Questions
Now, you probably know that DOM and SAX are related to Programming, while DOM and Java and DOM and .NET are related to DOM. DOM and Java isn't related to SAX, of course.
In outlining, these relationships are expressed as parent-child relationships, and they translate perfectly into the parent-child relathiponships between elements. For example, I can create an outline like so:
<opml version="1.0"> <body> <outline text="Overview"> <outline text="What is XML?"/> </outline> <outline text="Table of Contents"> <outline text="Programming"> <outline text="DOM"> <outline text="DOM and Java"/> <outline text="DOM and .NET"/> </outline> <outline text="SAX"> <outline text="SAX and Java"/> <outline text="SAX and .NET"/> </outline> </outline> <outline text="XML in Use: New Languages"> <outline text="DocBook"/> <outline text="SVG"/> </outline> </outline> <outline text="Additional Resources"> <outline text="Frequently Asked Questions"/> </outline> </body> </opml>
Just as it is conceptually, the element representing DOM is the parent of the element representing DOM and Java. In fact, this is a specific XML vocabulary called Outline Processor Markup Language, or OPML, which is designed to work with outliners.
Never heard of an outliner? Sure you have. Ever created an outline in Microsoft Word by using the Heading styles? How about navigated your hard drive using Windows Explorer? Those are both outliners, in that they organize information into a hierarchy and enable the user to decide which sections should show more detail.
There was a time when outliners came as separate products, such as MORE and ThinkTank, but now they're built into many products and systems, and with their place as the backbone of applications such as the popular Radio Userland they're gaining popularity in the blogging world. For example, Blogrolling.com, which provides an easy way for bloggers to maintian a list of sites they recommend, allows users to directly import OPML files. The Frontier server automatically detects whether a browser is better off receiving OPML directly or a version transformed into HTML, and returns the appropriate version.
So let's take a look at creating these files.
At it's heart, OPML is remarkably simple. As in the previous listing, an outline is basically outline elements within outline elements. An outline processor such as JOE can read this file and act accordingly.
(This structure, by the way, makes it convenient to include one outline within another.)
By adding some optional metadata elements, we can make this outline even more useful:
<?xml version="1.0" encoding="ISO-8859-1"?> <opml version="1.0"> <head> <title>The InformIT XML Reference Guide</title> <dateCreated>Wed, 3 Dec 2003 05:02:23 GMT</dateCreated> <dateModified>Wed, 3 Dec 2003 05:02:23 GMT</dateModified> <ownerName>Nicholas Chase, Guide</ownerName> <ownerEmail>informit@nicholaschase.com</ownerEmail> <expansionState>2,3,4</expansionState> <vertScrollState>1</vertScrollState> <windowTop>100</windowTop> <windowLeft>100</windowLeft> <windowBottom>300</windowBottom> <windowRight>300</windowRight> <applyStyleForComments>true</applyStyleForComments> <applyStyleForEditability>true</applyStyleForEditability> <applyStyleForMoveability>true</applyStyleForMoveability> </head> <body> <outline text="Overview"> <outline text="What is XML?"/> </outline> <outline text="Table of Contents"> <outline text="Programming"> <outline text="DOM"> <outline text="DOM and Java"/> <outline text="DOM and .NET"/> </outline> <outline text="SAX"> <outline text="SAX and Java"/> <outline text="SAX and .NET"/> </outline> </outline> <outline text="XML in Use: New Languages"> <outline text="DocBook"/> <outline text="SVG"/> </outline> </outline> <outline text="Additional Resources"> <outline text="Frequently Asked Questions"/> </outline> </body> </opml>
OPML specifies three basic types of optional metadata: identifying information such as title and ownerName, positioning information that's only used when the outline is displayed in its own window, such as windowTop and windowLeft, and information related to the outline itself, such as expansionState and applyStyleForComments. Together, these provide instructions for the processor.
OPML also provides for additonal attributes such as comments.
One common use is for displaying HTML, such as links, so it's improtant to look at a couple of issues that may arise when you try.
Say, for example, that I wanted to create an OPML document out of the blogroll for my personal blog, Chaos Magnet. I'd have to include HTML in the text attribute. If I did that straight, as in:
<?xml version="1.0" encoding="ISO-8859-1"?> <opml version="1.0"> <body> <outline text="<a href='http://xml.informit.com'>The InformIT XML Reference Guide</a>"/> <outline text="<a href='http://www.vanguardreport.com'>The Vanguard Science Fiction Report</a>"/> <outline text="<a href='xmlhack.com'>XML Hack</a>"/> <outline text="<a href='http://www.garybembridge.com/blog.htm'>Gary Bembridge's Weird Stuff</a>"/> ... </body> </opml>
we'd have a major problem. In fact, because the first example of OPML I'd ever seen had a construction like this, I'd discounted it as not being "real XML". So what's the problem?
The problem is that well-formed XML can't have a < in an attribute value. All is not lost, however, because you can use XML's predefined entities to solve the problem. This makes the correct version
<?xml version="1.0" encoding="ISO-8859-1"?> <opml version="1.0"> <body> <outline text="<a href='http://xml.informit.com'>The InformIT XML Reference Guide</a>"/> <outline text="<a href='http://www.vanguardreport.com'>The Vanguard Science Fiction Report</a>"/> <outline text="<a href='xmlhack.com'>XML Hack</a>"/> <outline text="<a href='http://www.garybembridge.com/blog.htm'>Gary Bembridge's Weird Stuff</a>"/> ... </body> </opml>
Similarly, you can use the " entity to avoid prematurely closing the text attribte value, as in
<?xml version="1.0" encoding="ISO-8859-1"?> <opml version="1.0"> <body> <outline text="<a href="http://xml.informit.com">The InformIT XML Reference Guide</a>"/> <outline text="<a href="http://www.vanguardreport.com">The Vanguard Science Fiction Report</a>"/> <outline text="<a href="xmlhack.com">XML Hack</a>"/> <outline text="<a href="http://www.garybembridge.com/blog.htm">Gary Bembridge's Weird Stuff</a>"/> ... </body> </opml>
And that, in a nutshell, is it. Check out the resources for more information on OPML itself and on uses and other implementations.