org.milyn.dtd
Class DTDStore

java.lang.Object
  extended by org.milyn.dtd.DTDStore

public class DTDStore
extends Object

DTD Datastore class.

Simple class providing a query interface to the underlying DTD DOM implementation. The intension is to hide this underlying implementation as much as possible so it can be changed in the future. See DTDStore.DTDObjectContainer.

At the moment this class uses the com.wutka DTD parser. We've also tried some other DTD parsers but they all had the same missing feature which was that they didn't keep attribute typing info (implemented using entities). This would be a very valuable feature for the purposes of this module.

Example:
In the example below, it would have been usefull to have been able to look at the xmlns attibute and recognise the fact that it was used to hold URI data.

 <!ELEMENT html (head, body)>
 <!ATTLIST html
                %i18n;
                id          ID             #IMPLIED
                xmlns       %URI;          #FIXED 'http://www.w3.org/1999/xhtml'
 >
 
where URI is defined as:
 <!ENTITY % URI "CDATA">
                <!-- a Uniform Resource Identifier, see [RFC2396] -->
 
If this information was available we could target ContentHandlers at elements containing "URI" attributes.

Another examples of this idea of using DTD ENTITY definitions to target ContentHandlers at specific elements (rather than using the element names) might be using ENTITYs like the following (from http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd):

 
 <!ENTITY % heading "h1|h2|h3|h4|h5|h6">
 <!ENTITY % lists "ul | ol | dl | menu | dir">
 <!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
 
 <!ENTITY % block
     "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
 
 <!-- %Flow; mixes block and inline and is used for list items etc. -->
 <!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">

Author:
tfennelly

Nested Class Summary
static class DTDStore.DTDObjectContainer
          Container class for the underlying DTD implementation.
 
Constructor Summary
DTDStore()
           
 
Method Summary
static void addDTD(ProfileSet profileSet, InputStream stream)
          Add the DTD for the profileSet device
static DTDStore.DTDObjectContainer getDTDObject(ProfileSet profileSet)
          Get the DTD Object for the profile, wrapped in a DTDStore.DTDObjectContainer instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTDStore

public DTDStore()
Method Detail

addDTD

public static void addDTD(ProfileSet profileSet,
                          InputStream stream)
Add the DTD for the profileSet device

Parameters:
profileSet - Device Context
stream - DTD data stream.

getDTDObject

public static DTDStore.DTDObjectContainer getDTDObject(ProfileSet profileSet)
Get the DTD Object for the profile, wrapped in a DTDStore.DTDObjectContainer instance.

Parameters:
profileSet - Profile set.
Returns:
The DTD Object reference container for the deviceContext device.


Copyright © 2008. All Rights Reserved.