All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class uhr.core.tron.SimpleParserXML

java.lang.Object
   |
   +----uhr.core.tron.SimpleParserXML

public class SimpleParserXML
extends Object
This class parses XML into a data structure. Only the very simplest aspects of XML are supported. Features are:
1. Duplicate tags are permitted directly within an element.

2. Only basic tags, comments and "<?" are supported. A basic tag is of the format <TagName>data or elements</TagName>. Empty tags like <TagName/@gt; are not supported. Attributes are not sopported. Entities are not yet implemented.

3. Cannot mix character data and elements within an element. After all, an Infotron node can only be a value (data) or a container (element with children).

4. Empty elements are provided with a null value, not an empty String.

5. All lines are trimmed and then one space is added at the end to separate possible words. If you want to delimit lines of character data, we suggest a semi-colon at the end.

6. Nested comments are not supported.

A very small parser such as this one has the advantage of allowing the core to be parameter driven in an embedded environment. We expect to eventually use a third party parser as needs arise, the industry/technology settles down, and they become more appropriate for our needs.

The unit test is: java -nojit uhr.core.test.SimpleParserXML_Test1


Constructor Index

 o SimpleParserXML()

Method Index

 o parseInto(String, Flexitron)
Parses the text into a Flexitron.
 o parseText(String)
Same as parseInto(String, Flexitron) except it creates a new InfotronStd() to be used as the Flexitron, and returns it.

Constructors

 o SimpleParserXML
 public SimpleParserXML()

Methods

 o parseInto
 public void parseInto(String text,
                       Flexitron tron)
Parses the text into a Flexitron. See class documentation.

The provided Flexitron allows the client to parse directly into the Flexitron configuration and implementation preferred. For example if Param extends FlexitronStd and FlexitronStd implements Flexitron, a Param can be the tron argument.

Note the provided flexitron must have a configuration compatible with the provided text.

Parameters:
text - the XML text to parse.
tron - the Flexitron to use as the root data structure. All subcontainers will be replications of the root, yielding a tree of uniformly configured Flexitrons.
 o parseText
 public Flexitron parseText(String text)
Same as parseInto(String, Flexitron) except it creates a new InfotronStd() to be used as the Flexitron, and returns it.

Parameters:
text - the XML text to parse.
Returns:
the Flexitron containing the parsed text.

All Packages  Class Hierarchy  This Package  Previous  Next  Index