com.croftsoft.core.text.sml
Class SmlNodeLib

java.lang.Object
  extended by com.croftsoft.core.text.sml.SmlNodeLib

public final class SmlNodeLib
extends Object

A library of static methods for manipulating SmlNode objects.

Java 1.1 compatible.

Since:
2001-05-10
Version:
2001-05-14
Author:
David W. Croft

Method Summary
static boolean isCDataCharacter(char c)
           
static boolean isElementNameCharacter(char c)
           
static boolean isWhiteSpaceCharacter(char c)
           
static SmlNode load(String filename, boolean allowMixedChildren)
           
static void main(String[] args)
           
static void parse(InputStream inputStream, SmlParseHandler smlParseHandler)
          Parses an SML stream.
static SmlNode parse(String smlString)
           
static void save(String filename, SmlNode smlNode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(String[] args)

isCDataCharacter

public static boolean isCDataCharacter(char c)

isElementNameCharacter

public static boolean isElementNameCharacter(char c)

isWhiteSpaceCharacter

public static boolean isWhiteSpaceCharacter(char c)

load

public static SmlNode load(String filename,
                           boolean allowMixedChildren)
                    throws IOException
Throws:
IOException

parse

public static SmlNode parse(String smlString)

parse

public static void parse(InputStream inputStream,
                         SmlParseHandler smlParseHandler)
                  throws IOException
Parses an SML stream.

State Transitions:

 c == character data (cdata) character (excludes angle brackets)
 w == white space character
 e == element (tag) name character

 (+)     == saves character to buffer
 (cdata) == calls handleCData
 (open)  == calls handleElementOpen
 (close) == calls handleElementClose

 0 | c --> 0 (+), < --> 1 (cdata)
 1 | w --> 2, e --> 3 (+), / --> 6
 2 | w --> 2, e --> 3 (+)
 3 | e --> 3 (+), w --> 4, / --> 5, > --> 0 (open)
 4 | w --> 4, / --> 5, > --> 0 (open)
 5 | > --> 0 (open, close)
 6 | w --> 6, e --> 7 (+)
 7 | e --> 7 (+), w --> 8, > --> 0 (close)
 8 | w --> 8, > --> 0 (close)

  0 | reading cdata, seeking <
  1 | just after <; seeking element (tag) name, white space, or /
  2 | inside white space before tag name; seeking tag name
  3 | reading opening tag name; seeking white space, /, or >
  4 | inside white space after opening tag name; seeking / or >
  5 | found / after tag name, element has no children; seeking >
  6 | found / after <, closing tag; skipping white, seeking tag name
  7 | reading closing tag name; seeking white space or >
  8 | inside white space after closing tag name; seeking >
 

Throws:
IOException

save

public static void save(String filename,
                        SmlNode smlNode)
                 throws IOException
Throws:
IOException

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)