org.ceryle.tm
Class LTMProcessor

java.lang.Object
  extended by org.ceryle.tm.LTMProcessor
All Implemented Interfaces:
Constants, TopicMapBuilder

public class LTMProcessor
extends Object
implements Constants, TopicMapBuilder

Implements a parser for the Linear Topic Map Notation as described in the Ontopia paper of the same name, by Lars Marius Garshol. This implementation is used with TM4J, and extends the LTM 1.2 functionality; instances of this are marked by the phrase "LTM Extension".

It will accept Occurrences with either a quote-delimited value or the new LTM 1.2 "[[" and "]]" delimited value for resource data. Values that are URLs are automatically created as resource references (there is currently no way to store a URL as a String).

Because of #MERGEMAP directives, this LTMProcessor may end up processing multiple LTM files during the course of a single build. The base and resource locators of the initial LTM document are used for the resulting TopicMap. If a #BASEURI directive is encountered, this takes precedence.

Since:
JDK1.3
Version:
$Id: LTMProcessor.java,v 3.9 2007-06-15 12:09:32 altheim Exp $
Author:
Murray Altheim

Field Summary
 boolean displayNameIsLabel
          Variable controlling whether display names should call TopicMapProcessor.setLabel(Topic,String).
protected  Locator m_baseLoc
          The base Locator of the current TopicMap, as set by its source Locator or its own #BASEURI directive.
protected  Locator m_srcLoc
          The source Locator of the current TopicMap, as provided by its source Locator.
 boolean strictParsing
          Variable controlling whether strict XML parsing is active.
 Topic topicDescription
          A PSI-based Topic identifying the subject of "topic description".
 
Fields inherited from interface org.ceryle.util.Constants
Amp, AMP, Apos, APOS, APP_NAME, APP_VERSION_NAME, APP_VERSION_NUMBER, AT, BANG, BAR, BIT_dev, BIT_http, BIT_ignoreCom, BIT_merge, BIT_none, BIT_noPreload, BIT_simple, BIT_ui, BIT_unused1, BIT_unused2, BIT_unused3, BIT_validating, BIT_verbose, BIT_xcatalog, BIT_xlink, BIT_xmlnsAware, BIT_xsd, BROKB, BSlash, BSLASH, CERYLE_CREDITS_FILE, CERYLE_DATA_DIR, CERYLE_HIST_FILE, CERYLE_LICENSE_FILE, CERYLE_PREF_FILE, CERYLE_PROP, CERYLE_PROP_BASE, CERYLE_PROP_FILE, CERYLE_RSRC_DIR, CERYLE_THANKS_FILE, CFLEX, Colon, COLON, Comma, COMMA, CR, CRet, Dash, DASH, DEFAULT_DIRECTORY, DEVELOPER, DOLR, Dot, DOT, EIGHT, Ellip, EOF, EqQuot, EQUAL, Equals, False, FALSE, FileProt, Filesep, FileURL, Five, FIVE, FONTSIZES, Four, FOUR, FSchar, GCOL_PROP, GRAPH_PROP, GRAVE, GT, Hash, HASH, HOME_DIRECTORY, HOME_DIRECTORY_PATH, HOME_DIRECTORY_URL, HTML, HttpProt, HttpURL, INDENT, INDENT_0, INDENT_1, INDENT_10, INDENT_2, INDENT_3, INDENT_4, INDENT_5, INDENT_6, INDENT_7, INDENT_8, INDENT_9, INIT, LCURL, LCurly, LF, LFS, Localhost, LPAR, LParen, LS, LSBrkt, LSBrkt2, LSQB, LT, MT, NBSP, NEL, NINE, NL, NL20x, NLchar, No, Null, NULL, NULL_STATE, NumParams, One, ONE, Pathsep, Percent, PERO, PLUS, Prcnt, PS, QMark, QMARK, Quot, QUOT, RCURL, RCurly, RESOURCE_BUNDLE, RPAR, RParen, RSBrkt, RSBrkt2, RSQB, Semi, SEMI, SEVEN, SIX, Slash, SLASH, SP, SPACE, Stago, Star, STAR, Tab, TAB, Tee, Three, THREE, Tilde, TILDE, TM_PROP, True, TRUE, Two, TWO, Under, UNDER, URI, URL, VBar, WIKI_PROP, XNodePfx, XNodeURL, XtmExt, Yes, Zero, ZERO
 
Fields inherited from interface org.tm4j.topicmap.utils.TopicMapBuilder
OPTION_ADDED_THEMES
 
Constructor Summary
LTMProcessor(TopicMapProcessor tmprocessor)
          Constructor using a TopicMapProcessor tmprocessor.
 
Method Summary
 void build(InputStream source, Locator srcLoc, TopicMap topicmap)
          Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.
 void build(InputStream source, Locator srcLoc, TopicMap topicmap, Topic[] addedThemes)
          Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.
 void build(InputStream source, Locator srcLoc, TopicMap topicmap, TopicMapProvider provider)
          Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.
 void build(InputStream source, Locator srcLoc, TopicMap topicmap, TopicMapProvider provider, Topic[] addedThemes)
          Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.
 void build(InputStream source, TopicMap topicmap)
          Parses the source indicated by the TypedInputSource source, populating the provided Document.
 void build(InputStream source, TopicMap topicmap, TopicMapProvider provider)
          Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.
 void build(Reader reader, Locator srcLoc, TopicMap topicmap)
          Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.
 void build(Reader reader, Locator srcLoc, TopicMap topicmap, Topic[] addedThemes)
          Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.
 void build(Reader reader, Locator srcLoc, TopicMap topicmap, TopicMapProvider provider)
          Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.
 void build(Reader reader, Locator srcLoc, TopicMap topicmap, TopicMapProvider provider, Topic[] addedThemes)
          Parses the source indicated by the TypedInputSource source, populating the provided Document.
protected  boolean forward(Reader r)
          Read one character into thisChar, then read ahead nextChar.
 TopicMap getTopicMap()
          Returns the TopicMap generated as a result of parsing, or null if not available.
 boolean isSupportedProperty(String propertyName)
          Determines whether or not a specific property is supported by the TopicMapBuilder implementation.
 void mergeMap(TypedInputSource source)
          Merges the LTM file indicated by the TypedInputSource source, populating the provided Document.
 void require(Reader r, String string, String errMsg)
          Parse a required string.
 Association scanAssociation(Reader r)
          Scans until an association end delimiter (")"), returning the Association object.
 void scanComment(Reader r)
          Scans a C++ style comment.
protected  void scanDescription(Reader r, Topic topic)
          Scans forward for a topic description.
protected  void scanDirective(Reader r)
          Scans an LTM directive.
protected  String scanLiteral(Reader r, boolean normWS)
          Scans forward until the closing literal delimiter, returning a String whose LT, GT, QUOT, APOS and AMP characters have been converted to entities.
protected  String scanName(Reader r)
          Scans a Name [XML production 5].
 Occurrence scanOccurrence(Reader r)
          Scans until an occurrence end delimiter ("}"), returning the Occurrence object.
protected  String scanSpace(Reader r, boolean required)
          Scans space characters, reading forward until a non-space character is encountered.
protected  void scanSubjectIdentifier(Reader r, Topic topic)
          Scans forward for Published Subject Indicator (PSI).
 void scanSuperclass(Reader r, Topic subclass)
          Creates a superclass-subclass Association between the provided Topic and the scanned token representing a reference to the superclass Topic.
protected  String scanToEndOfLine(Reader r)
          Scans forward until an end-of-line character, returning the string.
 Topic scanTopic(Reader r)
          Scans until a topic end delimiter ("]"), returning the Topic object.
protected  void scanTopicName(Reader r, Topic topic)
          Scans forward for base name, sort name, and/or display name.
protected  Topic scanType(Reader r)
          Scans forward for topic, occurrence or association type (roleSpec), returning a Topic that serves as the object's type, i.e., the referent in its <instanceOf> or <roleSpec> element.
protected  String scanURI(Reader r)
          Scans a URI, rather loosely.
protected  void scanWhitespace(Reader r, boolean required)
          Scans white space [XML production 3], reading forward until a non-whitespace character is encountered.
protected  void setBaseLocator(TopicMap tm, Locator loc, Locator from)
          Because during processing of an LTM file we might encounter #MERGEMAP directives, causing sub-modules to be parsed, and because these sub-modules may themselves include their own #MERGEMAP or #BASEURI directives, only the original LTM source is able to set the resulting base URI.
 void setProperty(String propertyName, Object value)
          Set a configuration property for the builder which will be applied to the processing of subsequent invocations of the build() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

topicDescription

public Topic topicDescription
A PSI-based Topic identifying the subject of "topic description".


strictParsing

public boolean strictParsing
Variable controlling whether strict XML parsing is active. This mostly affects constraints on the content of XML Names.


displayNameIsLabel

public boolean displayNameIsLabel
Variable controlling whether display names should call TopicMapProcessor.setLabel(Topic,String). Default value is true.


m_baseLoc

protected Locator m_baseLoc
The base Locator of the current TopicMap, as set by its source Locator or its own #BASEURI directive.


m_srcLoc

protected Locator m_srcLoc
The source Locator of the current TopicMap, as provided by its source Locator.

Constructor Detail

LTMProcessor

public LTMProcessor(TopicMapProcessor tmprocessor)
Constructor using a TopicMapProcessor tmprocessor.

Parameters:
tmprocessor - the topic map processor used
See Also:
MessageHandler, Constants, TopicMapProcessor, TopicMap
Method Detail

mergeMap

public void mergeMap(TypedInputSource source)
              throws TopicMapException
Merges the LTM file indicated by the TypedInputSource source, populating the provided Document. This spawns a new parse() process.

LTM Extension

.

Parameters:
source - the TypedInputSource source to be parsed.
Throws:
TopicMapException

build

public void build(InputStream source,
                  TopicMap topicmap)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided Document. A convenience method that calls build(InputStream,Locator,TopicMap,TopicMapProvider).

Parameters:
source - the TypedInputSource source to be parsed
topicmap - the TopicMap to be populated
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(InputStream source,
                  TopicMap topicmap,
                  TopicMapProvider provider)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided TopicMap. A convenience method that calls build(InputStream,Locator,TopicMap,TopicMapProvider).

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Parameters:
source - the TypedInputSource source to be parsed
topicmap - the TopicMap to be populated
provider - the TopicMapProvider to be used to retrieve merged TopicMaps
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(InputStream source,
                  Locator srcLoc,
                  TopicMap topicmap,
                  TopicMapProvider provider)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Specified by:
build in interface TopicMapBuilder
Parameters:
source - the TypedInputSource source to be parsed
srcLoc - the base address of the source being parsed
topicmap - the TopicMap to be populated
provider - the TopicMapProvider to be used to retrieve merged TopicMaps
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(InputStream source,
                  Locator srcLoc,
                  TopicMap topicmap)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Specified by:
build in interface TopicMapBuilder
Parameters:
source - the TypedInputSource source to be parsed
srcLoc - the base address of the source being parsed
topicmap - the TopicMap to be populated
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(InputStream source,
                  Locator srcLoc,
                  TopicMap topicmap,
                  Topic[] addedThemes)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Specified by:
build in interface TopicMapBuilder
Parameters:
source - the TypedInputSource source to be parsed
srcLoc - the base address of the source being parsed
topicmap - the TopicMap to be populated
addedThemes - the themes to be added as the scope of validity for all objects in the TopicMap
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(InputStream source,
                  Locator srcLoc,
                  TopicMap topicmap,
                  TopicMapProvider provider,
                  Topic[] addedThemes)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Specified by:
build in interface TopicMapBuilder
Parameters:
source - the TypedInputSource source to be parsed
srcLoc - the base address of the source being parsed
topicmap - the TopicMap to be populated
provider - the TopicMapProvider to be used to retrieve merged TopicMaps
addedThemes - the themes to be added as the scope of validity for all objects in the TopicMap
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(Reader reader,
                  Locator srcLoc,
                  TopicMap topicmap,
                  TopicMapProvider provider)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Specified by:
build in interface TopicMapBuilder
Parameters:
reader - the Reader to be parsed
srcLoc - the base address of the source being parsed
topicmap - the TopicMap to be populated
provider - the TopicMapProvider to be used to retrieve merged TopicMaps
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(Reader reader,
                  Locator srcLoc,
                  TopicMap topicmap)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Specified by:
build in interface TopicMapBuilder
Parameters:
reader - the Reader to be parsed
srcLoc - the base address of the source being parsed
topicmap - the TopicMap to be populated
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(Reader reader,
                  Locator srcLoc,
                  TopicMap topicmap,
                  Topic[] addedThemes)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided TopicMap.

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Specified by:
build in interface TopicMapBuilder
Parameters:
reader - the Reader to be parsed
srcLoc - the base address of the source being parsed
topicmap - the TopicMap to be populated
addedThemes - the themes to be added as the scope of validity for all objects in the TopicMap
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

build

public void build(Reader reader,
                  Locator srcLoc,
                  TopicMap topicmap,
                  TopicMapProvider provider,
                  Topic[] addedThemes)
           throws IOException,
                  LocatorFactoryException,
                  TopicMapProcessingException,
                  PropertyVetoException,
                  TopicMapProviderException
Parses the source indicated by the TypedInputSource source, populating the provided Document.

An implementation method for org.tm4j.topicmap.TopicMapBuilder.

Specified by:
build in interface TopicMapBuilder
Parameters:
reader - the Reader to be parsed
srcLoc - the base address of the source being parsed
topicmap - the TopicMap to be populated
provider - the TopicMapProvider to be used to retrieve merged TopicMaps
addedThemes - the themes to be added as the scope of validity for all objects in the TopicMap
Throws:
TopicMapException - if any errors are encountered during parsing
IOException
LocatorFactoryException
TopicMapProcessingException
PropertyVetoException
TopicMapProviderException

setBaseLocator

protected void setBaseLocator(TopicMap tm,
                              Locator loc,
                              Locator from)
Because during processing of an LTM file we might encounter #MERGEMAP directives, causing sub-modules to be parsed, and because these sub-modules may themselves include their own #MERGEMAP or #BASEURI directives, only the original LTM source is able to set the resulting base URI. Always using this method to set the base Locator solves any problems.

Parameters:
tm - the TopicMap whose base URI is to be set
loc - the Locator to use as a base URI
from - the base Locator of the current TopicMap

setProperty

public void setProperty(String propertyName,
                        Object value)
                 throws BuilderPropertyNotRecognizedException,
                        BuilderPropertyInvalidException
Set a configuration property for the builder which will be applied to the processing of subsequent invocations of the build() method. A typical use of this method will be to set parser options prior to parsing the input stream.

This method currently throws a BuilderPropertyNotRecognizedException, as this class does not support any of the TM4J properties.

Specified by:
setProperty in interface TopicMapBuilder
Parameters:
propertyName - the name of the property to be set. See inidividual implementation classes for details of which properties are recognized by each implementation.
value - the value to be applied to the property.
Throws:
BuilderPropertyNotRecognizedException - if propertyName specifies a property which is not supported by the TopicMapBuilder implementation.
BuilderPropertyInvalidException - if value falls outside the supported range of values for the specified property.

isSupportedProperty

public boolean isSupportedProperty(String propertyName)
Determines whether or not a specific property is supported by the TopicMapBuilder implementation.

This method currently always returns false, as this class does not support any of the TM4J properties.

Specified by:
isSupportedProperty in interface TopicMapBuilder
Parameters:
propertyName - the name of the property to check for support.
Returns:
true if the property is supported and false otherwise.

getTopicMap

public TopicMap getTopicMap()
Returns the TopicMap generated as a result of parsing, or null if not available.

Returns:
the current topic map.

scanTopic

public Topic scanTopic(Reader r)
                throws TopicMapException
Scans until a topic end delimiter ("]"), returning the Topic object. If the scan results in a String containing significant content, an Topic object will be sent to the XTMFactory for further processing. Note that at this level, no checking for existing Topic objects is done.

LTM Extension: a semicolon following the topic ID (rather than a colon) indicates the superclass of this topic.

Parameters:
r - the Reader used to provide parsed content.
Throws:
TopicMapException

scanSuperclass

public void scanSuperclass(Reader r,
                           Topic subclass)
                    throws TopicMapException
Creates a superclass-subclass Association between the provided Topic and the scanned token representing a reference to the superclass Topic.

NOTE: This is an extension to LTM 1.0.

Throws:
TopicMapException

scanTopicName

protected void scanTopicName(Reader r,
                             Topic topic)
                      throws TopicMapException
Scans forward for base name, sort name, and/or display name. Adds any associated markup to the provided Topic object. Note that display and sort name variants will always be attached to the last base name encountered.
   [id : type = "baseName" ; "sortname" ; "dispname" / scope [NAME+]
              = "baseName2" ; "sortname2" ; "dispname2" / scope2 [NAME+]

 

Parameters:
r - a Reader providing access to the document content.
topic - the topic to decorate with name information.
Throws:
TopicMapException

scanOccurrence

public Occurrence scanOccurrence(Reader r)
                          throws TopicMapException
Scans until an occurrence end delimiter ("}"), returning the Occurrence object. If the scan results in a String containing significant content, an Occurrence object will be sent to the XTMFactory for further processing.

Parameters:
r - the Reader used to provide parsed content.
Throws:
TopicMapException

scanDirective

protected void scanDirective(Reader r)
                      throws TopicMapException
Scans an LTM directive. These are custom keywords designed to provide extended functionality, consisting of name/value pairs. Currently accepted directives include:
#TOPICMAP [whitespace]* "id"
Sets the ID value of the <topicMap> element.

Note that the double quotes surrounding the ID value are optional.

#BASEURI [whitespace]* "URI"
Sets the xml:base attribute value on the <topicMap> element.
#MERGEMAP [whitespace]* "URI" [whitespace] STRING
Merges the LTM document located at uri of syntax STRING with the current document.

LTM 1.0 Extension (now part of LTM 1.2)

.

Parameters:
r - the Reader used to provide parsed content.
Throws:
TopicMapException

scanType

protected Topic scanType(Reader r)
                  throws TopicMapException,
                         ParseException
Scans forward for topic, occurrence or association type (roleSpec), returning a Topic that serves as the object's type, i.e., the referent in its <instanceOf> or <roleSpec> element. This is scanned as an XML Name (ID value), though it does allow an initial '#' character (which is ignored).

Parameters:
r - the Reader used to provide parsed content.
Throws:
TopicMapException
ParseException

scanAssociation

public Association scanAssociation(Reader r)
                            throws TopicMapException
Scans until an association end delimiter (")"), returning the Association object. This will include zero or more Member elements, with possible role types and Topics as members. Note that Topics parsed during this process will be added to the TopicMap if they do not already exist (the second example).
    typingTopicId( topic1Id : roleSpec , topic2Id : roleSpec )
    typingTopicId( [topic1Id] : roleSpec , [topic2Id] : roleSpec )
 

Parameters:
r - the Reader used to provide parsed content.
Throws:
TopicMapException

scanDescription

protected void scanDescription(Reader r,
                               Topic topic)
                        throws TopicMapException
Scans forward for a topic description. Adds this literal to the provided Topic as a typed occurrence.

LTM Extension

.

Throws:
TopicMapException

scanSubjectIdentifier

protected void scanSubjectIdentifier(Reader r,
                                     Topic topic)
                              throws TopicMapException,
                                     ParseException
Scans forward for Published Subject Indicator (PSI). Adds any associated markup to the provided topic element. Uses a <topicRef> if the PSI is a local fragment identifier (i.e., begins with #).

Throws:
TopicMapException
ParseException

scanLiteral

protected String scanLiteral(Reader r,
                             boolean normWS)
                      throws ParseException
Scans forward until the closing literal delimiter, returning a String whose LT, GT, QUOT, APOS and AMP characters have been converted to entities.

Throws:
ParseException

require

public void require(Reader r,
                    String string,
                    String errMsg)
             throws ParseException
Parse a required string. If it doesn't occur, throw an Exception.

Throws:
ParseException

scanToEndOfLine

protected String scanToEndOfLine(Reader r)
                          throws ParseException
Scans forward until an end-of-line character, returning the string. This is provided for error recovery.

Throws:
ParseException
See Also:
XMLCharTok

scanComment

public void scanComment(Reader r)
                 throws ParseException
Scans a C++ style comment. Currently nothing is returned.

Parameters:
r - the Reader used to provide parsed content.
Throws:
ParseException

scanURI

protected String scanURI(Reader r)
                  throws ParseException
Scans a URI, rather loosely. Reads forward until a whitespace character, returning the String. This can be used to scan URIs or other Strings that have no literal delimiters.

Parameters:
r - the Reader used to provide parsed content.
Throws:
ParseException

scanName

protected String scanName(Reader r)
                   throws ParseException
Scans a Name [XML production 5]. Reads forward until a non-name character, returning the String.

Parameters:
r - the Reader used to provide parsed content.
Throws:
ParseException

scanWhitespace

protected void scanWhitespace(Reader r,
                              boolean required)
                       throws ParseException
Scans white space [XML production 3], reading forward until a non-whitespace character is encountered. If required is true, then at least one character of whitespace is required or an error will be generated.

Throws:
ParseException

scanSpace

protected String scanSpace(Reader r,
                           boolean required)
                    throws ParseException
Scans space characters, reading forward until a non-space character is encountered. If required is true, then at least one space character is required or an error will be generated.

Returns:
the spaces as a String.
Throws:
ParseException

forward

protected boolean forward(Reader r)
                   throws ParseException
Read one character into thisChar, then read ahead nextChar. Returns true if thisChar is whitespace.

Parameters:
r - the Reader used to provide parsed content.
Returns:
true if the character read is whitespace.
Throws:
ParseException


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.