org.foray.xml.dtd
Class DTDTokenizer

java.lang.Object
  extended by org.foray.xml.dtd.DTDTokenizer

public final class DTDTokenizer
extends Object

Utility class for tokenizing a DTD.


Method Summary
static String[] arrayListToStrings(List<String> arrayList)
          Converts an ArrayList containing Strings to a String[].
static boolean hasElementChildren(String[] tokens)
          Indicates whether a set of tokens represents an element whose content model contains child elements.
static boolean hasPCDATA(String[] tokens)
          Indicates whether a set of tokens represents an element whose content model contains PCDATA.
static boolean isElementContentEmpty(String[] tokens)
          Indicates whether a set of tokens represents an element whose content model is empty.
static boolean isElementDelimiter(int character)
          Indicates whether a given character is an element delimiter.
static boolean isWhitespace(int character)
          Indicates whether a given character is whitespace.
static String[] tokenizeElementContent(String content)
          Returns the content of an Element as an array of String tokens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

tokenizeElementContent

public static String[] tokenizeElementContent(String content)
Returns the content of an Element as an array of String tokens. This method makes no assumptions about the source of the content. Specifically, although some parsers strip all whitespace out of the content, this method considers the possibility that there may be whitespace in the content.

Parameters:
content - The Element content to be parsed.
Returns:
An array of String tokens.

isWhitespace

public static boolean isWhitespace(int character)
Indicates whether a given character is whitespace.

Parameters:
character - The character to be tested.
Returns:
True iff the character is whitespace.

isElementDelimiter

public static boolean isElementDelimiter(int character)
Indicates whether a given character is an element delimiter.

Parameters:
character - The character to be tested.
Returns:
True iff the character is an element delimiter.

isElementContentEmpty

public static boolean isElementContentEmpty(String[] tokens)
Indicates whether a set of tokens represents an element whose content model is empty.

Parameters:
tokens - The tokens to be tested.
Returns:
True iff the content model is empty.

hasPCDATA

public static boolean hasPCDATA(String[] tokens)
Indicates whether a set of tokens represents an element whose content model contains PCDATA.

Parameters:
tokens - The tokens to be tested.
Returns:
True iff the content model contains PCDATA.

hasElementChildren

public static boolean hasElementChildren(String[] tokens)
Indicates whether a set of tokens represents an element whose content model contains child elements.

Parameters:
tokens - The tokens to be tested.
Returns:
True iff the content model contains child elements.

arrayListToStrings

public static String[] arrayListToStrings(List<String> arrayList)
Converts an ArrayList containing Strings to a String[].

Parameters:
arrayList - The raw list.
Returns:
A String array with arrayList's contents.


Copyright © 2017. All rights reserved.