org.alicebot.server.core.parser
Class XMLParser

java.lang.Object
  extended by org.alicebot.server.core.parser.XMLParser

public class XMLParser
extends java.lang.Object

A simple XML parser.

Author Pedro Colla describes it as a "poor man's XML non-validating parser".

Version:
4.1.4
Author:
Thomas Ringate/Pedro Colla

Field Summary
static java.lang.String CDATA_END
          A end of a CDATA block.
static java.lang.String CDATA_START
          The beginning of a CDATA block.
static java.lang.String COMMENT_END
          The end of an XML comment (!--).
static java.lang.String COMMENT_START
          The start of an XML comment (!--).
static java.lang.String EMPTY_STRING
          An empty string.
static java.lang.String MARKER_END
          An XML marker end (>).
static java.lang.String MARKER_START
          An XML marker start (≜).
static java.lang.String PI_START
          A question mark (starts a processing instruction).
static java.lang.String SLASH
          A slash.
static java.lang.String SPACE
          A space.
 
Constructor Summary
XMLParser()
           
 
Method Summary
 java.util.LinkedList load(java.lang.String buffer)
          Returns the full evaluation of a string containing an XML segment.
 java.util.LinkedList scan(java.util.ListIterator xmlIterator, java.util.LinkedList xmlList, java.util.LinkedList trie)
          Converts a linear linked list with parsed XML into a trie.
 java.util.LinkedList XMLRead(java.lang.String input, java.util.LinkedList XMLList)
          Parses an input string containing an XML structure into its XML elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MARKER_START

public static final java.lang.String MARKER_START
An XML marker start (≜).

See Also:
Constant Field Values

COMMENT_START

public static final java.lang.String COMMENT_START
The start of an XML comment (!--).

See Also:
Constant Field Values

COMMENT_END

public static final java.lang.String COMMENT_END
The end of an XML comment (!--).

See Also:
Constant Field Values

PI_START

public static final java.lang.String PI_START
A question mark (starts a processing instruction).

See Also:
Constant Field Values

CDATA_START

public static final java.lang.String CDATA_START
The beginning of a CDATA block.

See Also:
Constant Field Values

CDATA_END

public static final java.lang.String CDATA_END
A end of a CDATA block.

See Also:
Constant Field Values

SLASH

public static final java.lang.String SLASH
A slash.

See Also:
Constant Field Values

MARKER_END

public static final java.lang.String MARKER_END
An XML marker end (>).

See Also:
Constant Field Values

SPACE

public static final java.lang.String SPACE
A space.

See Also:
Constant Field Values

EMPTY_STRING

public static final java.lang.String EMPTY_STRING
An empty string.

See Also:
Constant Field Values
Constructor Detail

XMLParser

public XMLParser()
Method Detail

XMLRead

public java.util.LinkedList XMLRead(java.lang.String input,
                                    java.util.LinkedList XMLList)
Parses an input string containing an XML structure into its XML elements.

Parameters:
input - the input string
XMLList - the list to which to add the parsed XML
Returns:
a linear linked list of the parsed XML

scan

public java.util.LinkedList scan(java.util.ListIterator xmlIterator,
                                 java.util.LinkedList xmlList,
                                 java.util.LinkedList trie)
Converts a linear linked list with parsed XML into a trie.

Parameters:
xmlIterator - an iterator on the XML linear linked list
xmlList - the parsed XML as a linear linked list
trie - the trie to modify and return
Returns:
a trie representation of the parsed XML

load

public java.util.LinkedList load(java.lang.String buffer)
Returns the full evaluation of a string containing an XML segment.

Parameters:
buffer - the XML segment
Returns:
trie representation of the XML