|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.japano.util.XMLElement
public class XMLElement
XMLElement is a representation of an XML object. The object is able to parse XML code.
XMLParseException
Field Summary | |
---|---|
static int |
NANOXML_MAJOR_VERSION
Major version of NanoXML. |
static int |
NANOXML_MINOR_VERSION
Minor version of NanoXML. |
Constructor Summary | |
---|---|
|
XMLElement()
Creates a new XML element. |
|
XMLElement(boolean skipLeadingWhitespace)
Creates a new XML element. |
|
XMLElement(java.util.Hashtable entities)
Creates a new XML element. |
|
XMLElement(java.util.Hashtable entities,
boolean skipLeadingWhitespace)
Creates a new XML element. |
|
XMLElement(java.util.Hashtable entities,
boolean skipLeadingWhitespace,
boolean ignoreCase)
Creates a new XML element. |
protected |
XMLElement(java.util.Hashtable entities,
boolean skipLeadingWhitespace,
boolean fillBasicConversionTable,
boolean ignoreCase)
Creates a new XML element. |
|
XMLElement(java.lang.String name,
java.lang.String content)
Creates a new, simple XML element. |
Method Summary | |
---|---|
void |
addChild(XMLElement child)
Adds a subobject. |
void |
addNode(XMLNode node)
|
void |
addProperty(java.lang.String key,
double value)
Adds a property. |
void |
addProperty(java.lang.String key,
int value)
Adds a property. |
void |
addProperty(java.lang.String key,
java.lang.Object value)
Adds a property. |
protected boolean |
checkCDATA(java.lang.StringBuffer buf)
Scans a special tag and if the tag is a CDATA section, append its content to buf. |
protected boolean |
checkLiteral(java.lang.String literal)
Scans the data for literal text. |
int |
countChildren()
Returns the number of subobjects of the object. |
protected XMLElement |
createAnotherElement()
Creates a new XML element. |
java.util.Enumeration |
enumerationerateChildren()
Enumerates the subobjects of the object. |
java.util.Enumeration |
enumerationeratePropertyNames()
Enumerates the attribute names. |
protected XMLParseException |
expectedInput(java.lang.String charSet)
A character has been expected. |
protected void |
finalize()
Cleans up the object when it's destroyed. |
java.util.Vector |
getChildren()
Returns the subobjects of the object. |
java.lang.String |
getContent()
Returns the #PCDATA content of the object. |
XMLElement |
getFirstElementWithName(java.lang.String name)
|
int |
getLineNr()
Returns the line nr on which the element is found. |
java.lang.String |
getName()
Returns the class (i.e. the name indicated in the element) of the object. |
java.lang.String |
getProperty(java.lang.String key)
Returns a property of the object. |
double |
getProperty(java.lang.String key,
double defaultValue)
Returns a floating point property of the object. |
int |
getProperty(java.lang.String key,
int defaultValue)
Returns an integer property of the object. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Returns a property of the object. |
protected XMLParseException |
invalidValue(java.lang.String key,
java.lang.String value)
Creates a parse exception for when an invalid value is given to a method. |
protected XMLParseException |
invalidValueSet(java.lang.String key)
Creates a parse exception for when an invalid valueset is given to a method. |
void |
parseCharArray(char[] input,
int offset,
int end)
Parses an XML definition starting at offset. |
void |
parseCharArray(char[] input,
int offset,
int end,
int startingLineNr)
Parses an XML definition starting at offset. |
void |
parseFromReader(java.io.Reader reader)
Reads an XML definition from a java.io.Reader and parses it. |
void |
parseFromReader(java.io.Reader reader,
int startingLineNr)
Reads an XML definition from a java.io.Reader and parses it. |
void |
parseString(java.lang.String string)
Parses an XML definition. |
void |
parseString(java.lang.String string,
int offset)
Parses an XML definition starting at offset. |
void |
parseString(java.lang.String string,
int offset,
int end)
Parses an XML definition starting at offset. |
void |
parseString(java.lang.String string,
int offset,
int end,
int startingLineNr)
Parses an XML definition starting at offset. |
protected char |
readChar()
Reads a character from a reader. |
void |
removeChild(XMLElement child)
Removes a child object. |
void |
removeProperty(java.lang.String name)
Removes an attribute. |
protected void |
resolveEntity(java.lang.StringBuffer buf)
Resolves an entity. |
protected void |
scanElement(XMLElement elt)
Scans an XML element. |
protected void |
scanIdentifier(java.lang.StringBuffer identifier)
Scans an identifier. |
protected void |
scanPCData(java.lang.StringBuffer data)
Scans a #PCDATA element. |
protected void |
scanString(java.lang.StringBuffer string)
Scans a string. |
protected char |
scanWhitespace()
Scans whitespace. |
protected char |
scanWhitespace(java.lang.StringBuffer buf)
Scans whitespace. |
void |
setContent(java.lang.String content)
Changes the content string. |
void |
setName(java.lang.String name)
Changes the element name. |
protected void |
skipComment()
Skips a comment. |
protected void |
skipSpecialTag(int bracketLevel)
Skips a special tag or comment. |
protected XMLParseException |
syntaxError(java.lang.String context)
A syntax error occured. |
java.lang.String |
toString()
Writes the XML element to a string. |
java.lang.String |
toStringFormatted()
Dito, nur formatiert |
protected XMLParseException |
unexpectedEndOfData()
The end of the data input has been reached. |
protected XMLParseException |
unknownEntity(java.lang.String key)
Invalid entity. |
protected void |
unreadChar(char ch)
Adds a character to the read-back buffer. |
protected XMLParseException |
valueMissingForAttribute(java.lang.String key)
A value is missing for an attribute. |
void |
write(java.io.Writer writer,
java.lang.String indent,
java.lang.String eol,
int nestingLevel)
Writes the XML element to a writer. |
protected void |
writeEncoded(java.io.Writer writer,
java.lang.String str)
Writes a string encoded to a writer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NANOXML_MAJOR_VERSION
public static final int NANOXML_MINOR_VERSION
Constructor Detail |
---|
public XMLElement()
& < >
' "
false
false
XMLElement(java.util.Hashtable)
,
XMLElement(boolean)
,
XMLElement(java.util.Hashtable,boolean)
public XMLElement(java.util.Hashtable entities)
& < >
' "
false
false
XMLElement()
,
XMLElement(boolean)
,
XMLElement(java.util.Hashtable,boolean)
public XMLElement(boolean skipLeadingWhitespace)
& < >
' "
false
XMLElement()
,
XMLElement(java.util.Hashtable)
,
XMLElement(java.util.Hashtable,boolean)
public XMLElement(java.util.Hashtable entities, boolean skipLeadingWhitespace)
& < >
' "
false
XMLElement()
,
XMLElement(boolean)
,
XMLElement(java.util.Hashtable)
public XMLElement(java.util.Hashtable entities, boolean skipLeadingWhitespace, boolean ignoreCase)
& < >
' "
(depending on fillBasicConversionTable)This constructor should only be called from XMLElement itself to create child elements.
XMLElement()
,
XMLElement(boolean)
,
XMLElement(java.util.Hashtable)
,
XMLElement(java.util.Hashtable,boolean)
public XMLElement(java.lang.String name, java.lang.String content)
name
- The name of the new XML Elementcontent
- The content of the new XML ElementXMLElement()
,
XMLElement(boolean)
,
XMLElement(java.util.Hashtable)
,
XMLElement(java.util.Hashtable,boolean)
protected XMLElement(java.util.Hashtable entities, boolean skipLeadingWhitespace, boolean fillBasicConversionTable, boolean ignoreCase)
& < >
' "
(depending on fillBasicConversionTable)This constructor should only be called from XMLElement itself to create child elements.
XMLElement()
,
XMLElement(boolean)
,
XMLElement(java.util.Hashtable)
,
XMLElement(java.util.Hashtable,boolean)
Method Detail |
---|
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void addChild(XMLElement child)
public void addProperty(java.lang.String key, java.lang.Object value)
public void addProperty(java.lang.String key, int value)
public void addProperty(java.lang.String key, double value)
public int countChildren()
public java.util.Enumeration enumerationeratePropertyNames()
public java.util.Enumeration enumerationerateChildren()
public java.util.Vector getChildren()
public java.lang.String getContent()
null
is returned.
public int getLineNr()
public java.lang.String getProperty(java.lang.String key)
null
.
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
public int getProperty(java.lang.String key, int defaultValue)
public double getProperty(java.lang.String key, double defaultValue)
public java.lang.String getName()
public void parseFromReader(java.io.Reader reader) throws java.io.IOException, XMLParseException
java.io.IOException
- if an error occured while reading the input
XMLParseException
- if an error occured while parsing the read datapublic void parseFromReader(java.io.Reader reader, int startingLineNr) throws java.io.IOException, XMLParseException
java.io.IOException
- if an error occured while reading the input
XMLParseException
- if an error occured while parsing the read datapublic void parseString(java.lang.String string) throws XMLParseException
XMLParseException
- if an error occured while parsing the stringpublic void parseString(java.lang.String string, int offset) throws XMLParseException
XMLParseException
- if an error occured while parsing the stringpublic void parseString(java.lang.String string, int offset, int end) throws XMLParseException
XMLParseException
- if an error occured while parsing the stringpublic void parseString(java.lang.String string, int offset, int end, int startingLineNr) throws XMLParseException
XMLParseException
- if an error occured while parsing the stringpublic void parseCharArray(char[] input, int offset, int end) throws XMLParseException
XMLParseException
- if an error occured while parsing the arraypublic void parseCharArray(char[] input, int offset, int end, int startingLineNr) throws XMLParseException
XMLParseException
- if an error occured while parsing the arraypublic void removeChild(XMLElement child)
public void removeProperty(java.lang.String name)
protected XMLElement createAnotherElement()
public void setContent(java.lang.String content)
content
- The new content string.public void setName(java.lang.String name)
name
- The new name.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringFormatted()
public void write(java.io.Writer writer, java.lang.String indent, java.lang.String eol, int nestingLevel) throws java.io.IOException
java.io.IOException
protected void writeEncoded(java.io.Writer writer, java.lang.String str) throws java.io.IOException
java.io.IOException
protected void scanIdentifier(java.lang.StringBuffer identifier) throws java.io.IOException
java.io.IOException
protected char scanWhitespace() throws java.io.IOException
java.io.IOException
protected char scanWhitespace(java.lang.StringBuffer buf) throws java.io.IOException
java.io.IOException
protected void scanString(java.lang.StringBuffer string) throws java.io.IOException
java.io.IOException
protected void scanPCData(java.lang.StringBuffer data) throws java.io.IOException
java.io.IOException
protected boolean checkCDATA(java.lang.StringBuffer buf) throws java.io.IOException
java.io.IOException
protected void skipComment() throws java.io.IOException
java.io.IOException
protected void skipSpecialTag(int bracketLevel) throws java.io.IOException
java.io.IOException
protected boolean checkLiteral(java.lang.String literal) throws java.io.IOException
java.io.IOException
protected char readChar() throws java.io.IOException
java.io.IOException
protected void scanElement(XMLElement elt) throws java.io.IOException
java.io.IOException
protected void resolveEntity(java.lang.StringBuffer buf) throws java.io.IOException
java.io.IOException
protected void unreadChar(char ch)
protected XMLParseException invalidValueSet(java.lang.String key)
protected XMLParseException invalidValue(java.lang.String key, java.lang.String value)
protected XMLParseException unexpectedEndOfData()
protected XMLParseException syntaxError(java.lang.String context)
protected XMLParseException expectedInput(java.lang.String charSet)
protected XMLParseException valueMissingForAttribute(java.lang.String key)
protected XMLParseException unknownEntity(java.lang.String key)
public XMLElement getFirstElementWithName(java.lang.String name)
public void addNode(XMLNode node)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |