|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nanoxml.XMLElement
XMLElement is a representation of an XML object. The object is able to parse XML code.
XMLElement xml = new XMLElement();
FileReader reader = new FileReader("filename.xml");
xml.parseFromReader(reader);
enumerateAttributeNames
.
The attribute values can be retrieved using the method
getStringAttribute
.
The following example shows how to list the attributes of an element:
XMLElement element = ...;
Enumeration enum = element.getAttributeNames();
while (enum.hasMoreElements()) {
String key = (String) enum.nextElement();
String value = element.getStringAttribute(key);
System.out.println(key + " = " + value);
}
enumerateChildren
.
The number of child elements can be retrieved using
countChildren
.
<title>The Title</title>
getContent
.
createAnotherElement
which has to return a new copy of the receiver.
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 and initializes a new XML element. |
|
XMLElement(boolean skipLeadingWhitespace)
Creates and initializes a new XML element. |
|
XMLElement(Hashtable entities)
Creates and initializes a new XML element. |
|
XMLElement(Hashtable entities,
boolean skipLeadingWhitespace)
Creates and initializes a new XML element. |
|
XMLElement(Hashtable entities,
boolean skipLeadingWhitespace,
boolean ignoreCase)
Creates and initializes a new XML element. |
protected |
XMLElement(Hashtable entities,
boolean skipLeadingWhitespace,
boolean fillBasicConversionTable,
boolean ignoreCase)
Creates and initializes a new XML element. |
Method Summary | |
void |
addChild(XMLElement child)
Adds a child element. |
void |
addProperty(String name,
double value)
Deprecated. Use setDoubleAttribute instead. |
void |
addProperty(String key,
int value)
Deprecated. Use setIntAttribute instead. |
void |
addProperty(String name,
Object value)
Deprecated. Use setAttribute instead. |
protected boolean |
checkCDATA(StringBuffer buf)
Scans a special tag and if the tag is a CDATA section, append its content to buf . |
protected boolean |
checkLiteral(String literal)
Scans the data for literal text. |
int |
countChildren()
Returns the number of child elements of the element. |
protected XMLElement |
createAnotherElement()
Creates a new similar XML element. |
Enumeration |
enumerateAttributeNames()
Enumerates the attribute names. |
Enumeration |
enumerateChildren()
Enumerates the child elements. |
Enumeration |
enumeratePropertyNames()
Deprecated. Use enumerateAttributeNames instead. |
protected XMLParseException |
expectedInput(String charSet)
Creates a parse exception for when the next character read is not the character that was expected. |
Object |
getAttribute(String name)
Returns an attribute of the element. |
Object |
getAttribute(String name,
Hashtable valueSet,
String defaultKey,
boolean allowLiterals)
Returns an attribute by looking up a key in a hashtable. |
Object |
getAttribute(String name,
Object defaultValue)
Returns an attribute of the element. |
boolean |
getBooleanAttribute(String name,
String trueValue,
String falseValue,
boolean defaultValue)
Returns an attribute of the element. |
Vector |
getChildren()
Returns the child elements as a Vector. |
String |
getContent()
Returns the PCDATA content of the object. |
String |
getContents()
Deprecated. Use getContent instead. |
double |
getDoubleAttribute(String name)
Returns an attribute of the element. |
double |
getDoubleAttribute(String name,
double defaultValue)
Returns an attribute of the element. |
double |
getDoubleAttribute(String name,
Hashtable valueSet,
String defaultKey,
boolean allowLiteralNumbers)
Returns an attribute by looking up a key in a hashtable. |
int |
getIntAttribute(String name)
Returns an attribute of the element. |
int |
getIntAttribute(String name,
Hashtable valueSet,
String defaultKey,
boolean allowLiteralNumbers)
Returns an attribute by looking up a key in a hashtable. |
int |
getIntAttribute(String name,
int defaultValue)
Returns an attribute of the element. |
int |
getIntProperty(String name,
Hashtable valueSet,
String defaultKey)
Deprecated. Use getIntAttribute instead. |
int |
getLineNr()
Returns the line nr in the source data on which the element is found. |
String |
getName()
Returns the name of the element. |
String |
getProperty(String name)
Deprecated. Use getStringAttribute instead. |
double |
getProperty(String name,
double defaultValue)
Deprecated. Use getDoubleAttribute instead. |
Object |
getProperty(String name,
Hashtable valueSet,
String defaultKey)
Deprecated. Use getAttribute instead. |
int |
getProperty(String name,
int defaultValue)
Deprecated. Use getIntAttribute instead. |
String |
getProperty(String name,
String defaultValue)
Deprecated. Use getStringAttribute instead. |
boolean |
getProperty(String key,
String trueValue,
String falseValue,
boolean defaultValue)
Deprecated. Use getBooleanAttribute instead. |
double |
getSpecialDoubleProperty(String name,
Hashtable valueSet,
String defaultKey)
Deprecated. Use getDoubleAttribute instead. |
int |
getSpecialIntProperty(String name,
Hashtable valueSet,
String defaultKey)
Deprecated. Use getIntAttribute instead. |
String |
getStringAttribute(String name)
Returns an attribute of the element. |
String |
getStringAttribute(String name,
Hashtable valueSet,
String defaultKey,
boolean allowLiterals)
Returns an attribute by looking up a key in a hashtable. |
String |
getStringAttribute(String name,
String defaultValue)
Returns an attribute of the element. |
String |
getStringProperty(String name,
Hashtable valueSet,
String defaultKey)
Deprecated. Use getStringAttribute instead. |
String |
getTagName()
Deprecated. Use getName instead. |
protected XMLParseException |
invalidValue(String name,
String value)
Creates a parse exception for when an invalid value is given to a method. |
protected XMLParseException |
invalidValueSet(String name)
Creates a parse exception for when an invalid valueset is given to a method. |
void |
parseCharArray(char[] input,
int offset,
int end)
Reads one XML element from a char array and parses it. |
void |
parseCharArray(char[] input,
int offset,
int end,
int startingLineNr)
Reads one XML element from a char array and parses it. |
void |
parseFromReader(Reader reader)
Reads one XML element from a java.io.Reader and parses it. |
void |
parseFromReader(Reader reader,
int startingLineNr)
Reads one XML element from a java.io.Reader and parses it. |
void |
parseString(String string)
Reads one XML element from a String and parses it. |
void |
parseString(String string,
int offset)
Reads one XML element from a String and parses it. |
void |
parseString(String string,
int offset,
int end)
Reads one XML element from a String and parses it. |
void |
parseString(String string,
int offset,
int end,
int startingLineNr)
Reads one XML element from a String and parses it. |
protected char |
readChar()
Reads a character from a reader. |
void |
removeAttribute(String name)
Removes an attribute. |
void |
removeChild(String name)
Deprecated. Use removeAttribute instead. |
void |
removeChild(XMLElement child)
Removes a child element. |
void |
removeProperty(String name)
Deprecated. Use removeAttribute instead. |
protected void |
resolveEntity(StringBuffer buf)
Resolves an entity. |
protected void |
scanElement(XMLElement elt)
Scans an XML element. |
protected void |
scanIdentifier(StringBuffer result)
Scans an identifier from the current reader. |
protected void |
scanPCData(StringBuffer data)
Scans a #PCDATA element. |
protected void |
scanString(StringBuffer string)
This method scans a delimited string from the current reader. |
protected char |
scanWhitespace()
This method scans an identifier from the current reader. |
protected char |
scanWhitespace(StringBuffer result)
This method scans an identifier from the current reader. |
void |
setAttribute(String name,
Object value)
Adds or modifies an attribute. |
void |
setContent(String content)
Changes the content string. |
void |
setDoubleAttribute(String name,
double value)
Adds or modifies an attribute. |
void |
setIntAttribute(String name,
int value)
Adds or modifies an attribute. |
void |
setName(String name)
Changes the name of the element. |
void |
setTagName(String name)
Deprecated. Use setName instead. |
protected void |
skipComment()
Skips a comment. |
protected void |
skipSpecialTag(int bracketLevel)
Skips a special tag or comment. |
protected XMLParseException |
syntaxError(String context)
Creates a parse exception for when a syntax error occured. |
String |
toString()
Writes the XML element to a string. |
protected XMLParseException |
unexpectedEndOfData()
Creates a parse exception for when the end of the data input has been reached. |
protected XMLParseException |
unknownEntity(String name)
Creates a parse exception for when an entity could not be resolved. |
protected void |
unreadChar(char ch)
Pushes a character back to the read-back buffer. |
void |
write(Writer writer)
Writes the XML element to a writer. |
protected void |
writeEncoded(Writer writer,
String str)
Writes a string encoded to a writer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NANOXML_MAJOR_VERSION
NANOXML_MINOR_VERSION
,
Constant Field Valuespublic static final int NANOXML_MINOR_VERSION
NANOXML_MAJOR_VERSION
,
Constant Field ValuesConstructor Detail |
public XMLElement()
new XMLElement(new Hashtable(), false, true)
XMLElement(Hashtable)
,
XMLElement(boolean)
,
XMLElement(Hashtable, boolean)
public XMLElement(Hashtable entities)
new XMLElement(entities, false, true)
entities
- The entity conversion table.
entities != null
XMLElement()
,
XMLElement(boolean)
,
XMLElement(Hashtable, boolean)
public XMLElement(boolean skipLeadingWhitespace)
new XMLElement(new Hashtable(), skipLeadingWhitespace, true)
skipLeadingWhitespace
- true
if leading and trailing whitespace in PCDATA
content has to be removed.
XMLElement()
,
XMLElement(Hashtable)
,
XMLElement(Hashtable, boolean)
public XMLElement(Hashtable entities, boolean skipLeadingWhitespace)
new XMLElement(entities, skipLeadingWhitespace, true)
entities
- The entity conversion table.skipLeadingWhitespace
- true
if leading and trailing whitespace in PCDATA
content has to be removed.
entities != null
XMLElement()
,
XMLElement(boolean)
,
XMLElement(Hashtable)
public XMLElement(Hashtable entities, boolean skipLeadingWhitespace, boolean ignoreCase)
entities
- The entity conversion table.skipLeadingWhitespace
- true
if leading and trailing whitespace in PCDATA
content has to be removed.ignoreCase
- true
if the case of element and attribute names have
to be ignored.
entities != null
XMLElement()
,
XMLElement(boolean)
,
XMLElement(Hashtable)
,
XMLElement(Hashtable, boolean)
protected XMLElement(Hashtable entities, boolean skipLeadingWhitespace, boolean fillBasicConversionTable, boolean ignoreCase)
This constructor should only be called from
createAnotherElement
to create child elements.
entities
- The entity conversion table.skipLeadingWhitespace
- true
if leading and trailing whitespace in PCDATA
content has to be removed.fillBasicConversionTable
- true
if the basic entities need to be added to
the entity list.ignoreCase
- true
if the case of element and attribute names have
to be ignored.
entities != null
fillBasicConversionTable == false
then entities
contains at least the following
entries: amp
, lt
, gt
,
apos
and quot
createAnotherElement()
Method Detail |
public void addChild(XMLElement child)
child
- The child element to add.
child != null
child.getName() != null
child
does not have a parent element
countChildren()
,
enumerateChildren()
,
getChildren()
,
removeChild(XMLElement)
public void setAttribute(String name, Object value)
name
- The name of the attribute.value
- The value of the attribute.
name != null
name
is a valid XML identifier
value != null
setDoubleAttribute(String, double)
,
setIntAttribute(String, int)
,
enumerateAttributeNames()
,
getAttribute(String)
,
getAttribute(String, Object)
,
getAttribute(String, Hashtable, String, boolean)
,
getStringAttribute(String)
,
getStringAttribute(String, String)
,
getStringAttribute(String, Hashtable, String, boolean)
public void addProperty(String name, Object value)
setAttribute
instead.
name
- The name of the attribute.value
- The value of the attribute.public void setIntAttribute(String name, int value)
name
- The name of the attribute.value
- The value of the attribute.
name != null
name
is a valid XML identifier
setDoubleAttribute(String, double)
,
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
,
getIntAttribute(String)
,
getIntAttribute(String, int)
,
getIntAttribute(String, Hashtable, String, boolean)
public void addProperty(String key, int value)
setIntAttribute
instead.
value
- The value of the attribute.public void setDoubleAttribute(String name, double value)
name
- The name of the attribute.value
- The value of the attribute.
name != null
name
is a valid XML identifier
setIntAttribute(String, int)
,
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
,
getDoubleAttribute(String)
,
getDoubleAttribute(String, double)
,
getDoubleAttribute(String, Hashtable, String, boolean)
public void addProperty(String name, double value)
setDoubleAttribute
instead.
name
- The name of the attribute.value
- The value of the attribute.public int countChildren()
result >= 0
addChild(XMLElement)
,
enumerateChildren()
,
getChildren()
,
removeChild(XMLElement)
public Enumeration enumerateAttributeNames()
result != null
setDoubleAttribute(String, double)
,
setIntAttribute(String, int)
,
setAttribute(String, Object)
,
removeAttribute(String)
,
getAttribute(String)
,
getAttribute(String, String)
,
getAttribute(String, Hashtable, String, boolean)
,
getStringAttribute(String)
,
getStringAttribute(String, String)
,
getStringAttribute(String, Hashtable, String, boolean)
,
getIntAttribute(String)
,
getIntAttribute(String, int)
,
getIntAttribute(String, Hashtable, String, boolean)
,
getDoubleAttribute(String)
,
getDoubleAttribute(String, double)
,
getDoubleAttribute(String, Hashtable, String, boolean)
,
getBooleanAttribute(String, String, String, boolean)
public Enumeration enumeratePropertyNames()
enumerateAttributeNames
instead.
public Enumeration enumerateChildren()
result != null
addChild(XMLElement)
,
countChildren()
,
getChildren()
,
removeChild(XMLElement)
public Vector getChildren()
result != null
addChild(XMLElement)
,
countChildren()
,
enumerateChildren()
,
removeChild(XMLElement)
public String getContents()
getContent
instead.
null
is returned.
public String getContent()
null
is returned.
setContent(String)
public int getLineNr()
0
there is no associated source data.
result >= 0
public Object getAttribute(String name)
null
is returned.
name
- The name of the attribute.
name != null
name
is a valid XML identifier
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
,
getAttribute(String, Object)
,
getAttribute(String, Hashtable, String, boolean)
public Object getAttribute(String name, Object defaultValue)
defaultValue
is returned.
name
- The name of the attribute.defaultValue
- Key to use if the attribute is missing.
name != null
name
is a valid XML identifier
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
,
getAttribute(String)
,
getAttribute(String, Hashtable, String, boolean)
public Object getAttribute(String name, Hashtable valueSet, String defaultKey, boolean allowLiterals)
As an example, if valueSet contains the mapping "one" =>
"1"
and the element contains the attribute attr="one"
, then
getAttribute("attr", mapping, defaultKey, false)
returns
"1"
.
name
- The name of the attribute.valueSet
- Hashtable mapping keys to values.defaultKey
- Key to use if the attribute is missing.allowLiterals
- true
if literals are valid.
name != null
name
is a valid XML identifier
valueSet
!= null
valueSet
are strings
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
,
getAttribute(String)
,
getAttribute(String, Object)
public String getStringAttribute(String name)
null
is returned.
name
- The name of the attribute.
name != null
name
is a valid XML identifier
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
,
getStringAttribute(String, String)
,
getStringAttribute(String, Hashtable, String, boolean)
public String getStringAttribute(String name, String defaultValue)
defaultValue
is returned.
name
- The name of the attribute.defaultValue
- Key to use if the attribute is missing.
name != null
name
is a valid XML identifier
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
,
getStringAttribute(String)
,
getStringAttribute(String, Hashtable, String, boolean)
public String getStringAttribute(String name, Hashtable valueSet, String defaultKey, boolean allowLiterals)
As an example, if valueSet contains the mapping "one" =>
"1"
and the element contains the attribute attr="one"
, then
getAttribute("attr", mapping, defaultKey, false)
returns
"1"
.
name
- The name of the attribute.valueSet
- Hashtable mapping keys to values.defaultKey
- Key to use if the attribute is missing.allowLiterals
- true
if literals are valid.
name != null
name
is a valid XML identifier
valueSet
!= null
valueSet
are strings
valueSet
are strings
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
,
getStringAttribute(String)
,
getStringAttribute(String, String)
public int getIntAttribute(String name)
0
is returned.
name
- The name of the attribute.
name != null
name
is a valid XML identifier
setIntAttribute(String, int)
,
enumerateAttributeNames()
,
getIntAttribute(String, int)
,
getIntAttribute(String, Hashtable, String, boolean)
public int getIntAttribute(String name, int defaultValue)
defaultValue
is returned.
name
- The name of the attribute.defaultValue
- Key to use if the attribute is missing.
name != null
name
is a valid XML identifier
setIntAttribute(String, int)
,
enumerateAttributeNames()
,
getIntAttribute(String)
,
getIntAttribute(String, Hashtable, String, boolean)
public int getIntAttribute(String name, Hashtable valueSet, String defaultKey, boolean allowLiteralNumbers)
As an example, if valueSet contains the mapping "one" => 1
and the element contains the attribute attr="one"
, then
getIntAttribute("attr", mapping, defaultKey, false)
returns
1
.
name
- The name of the attribute.valueSet
- Hashtable mapping keys to values.defaultKey
- Key to use if the attribute is missing.allowLiteralNumbers
- true
if literal numbers are valid.
name != null
name
is a valid XML identifier
valueSet
!= null
valueSet
are strings
valueSet
are Integer objects
defaultKey
is either null
, a
key in valueSet
or an integer.
setIntAttribute(String, int)
,
enumerateAttributeNames()
,
getIntAttribute(String)
,
getIntAttribute(String, int)
public double getDoubleAttribute(String name)
0.0
is returned.
name
- The name of the attribute.
name != null
name
is a valid XML identifier
setDoubleAttribute(String, double)
,
enumerateAttributeNames()
,
getDoubleAttribute(String, double)
,
getDoubleAttribute(String, Hashtable, String, boolean)
public double getDoubleAttribute(String name, double defaultValue)
defaultValue
is returned.
name
- The name of the attribute.defaultValue
- Key to use if the attribute is missing.
name != null
name
is a valid XML identifier
setDoubleAttribute(String, double)
,
enumerateAttributeNames()
,
getDoubleAttribute(String)
,
getDoubleAttribute(String, Hashtable, String, boolean)
public double getDoubleAttribute(String name, Hashtable valueSet, String defaultKey, boolean allowLiteralNumbers)
As an example, if valueSet contains the mapping "one" =>
1.0
and the element contains the attribute attr="one"
, then
getDoubleAttribute("attr", mapping, defaultKey, false)
returns 1.0
.
name
- The name of the attribute.valueSet
- Hashtable mapping keys to values.defaultKey
- Key to use if the attribute is missing.allowLiteralNumbers
- true
if literal numbers are valid.
name != null
name
is a valid XML identifier
valueSet != null
valueSet
are strings
valueSet
are Double objects
defaultKey
is either null
, a
key in valueSet
or a double.
setDoubleAttribute(String, double)
,
enumerateAttributeNames()
,
getDoubleAttribute(String)
,
getDoubleAttribute(String, double)
public boolean getBooleanAttribute(String name, String trueValue, String falseValue, boolean defaultValue)
defaultValue
is returned.
If the value of the attribute is equal to trueValue
,
true
is returned.
If the value of the attribute is equal to falseValue
,
false
is returned.
If the value doesn't match trueValue
or
falseValue
, an exception is thrown.
name
- The name of the attribute.trueValue
- The value associated with true
.falseValue
- The value associated with true
.defaultValue
- Value to use if the attribute is missing.
name != null
name
is a valid XML identifier
trueValue
and falseValue
are different strings.
setAttribute(String, Object)
,
removeAttribute(String)
,
enumerateAttributeNames()
public int getIntProperty(String name, Hashtable valueSet, String defaultKey)
getIntAttribute
instead.
public String getProperty(String name)
getStringAttribute
instead.
public String getProperty(String name, String defaultValue)
getStringAttribute
instead.
public int getProperty(String name, int defaultValue)
getIntAttribute
instead.
public double getProperty(String name, double defaultValue)
getDoubleAttribute
instead.
public boolean getProperty(String key, String trueValue, String falseValue, boolean defaultValue)
getBooleanAttribute
instead.
public Object getProperty(String name, Hashtable valueSet, String defaultKey)
getAttribute
instead.
public String getStringProperty(String name, Hashtable valueSet, String defaultKey)
getStringAttribute
instead.
public int getSpecialIntProperty(String name, Hashtable valueSet, String defaultKey)
getIntAttribute
instead.
public double getSpecialDoubleProperty(String name, Hashtable valueSet, String defaultKey)
getDoubleAttribute
instead.
public String getName()
setName(String)
public String getTagName()
getName
instead.
public void parseFromReader(Reader reader) throws IOException, XMLParseException
reader
- The reader from which to retrieve the XML data.
reader != null
reader
is not closed
IOException
- If an error occured while reading the input.
XMLParseException
- If an error occured while parsing the read data.public void parseFromReader(Reader reader, int startingLineNr) throws IOException, XMLParseException
reader
- The reader from which to retrieve the XML data.startingLineNr
- The line number of the first line in the data.
reader != null
reader
is not closed
IOException
- If an error occured while reading the input.
XMLParseException
- If an error occured while parsing the read data.public void parseString(String string) throws XMLParseException
XMLParseException
- If an error occured while parsing the string.public void parseString(String string, int offset) throws XMLParseException
offset
- The first character in string
to scan.
string != null
offset < string.length()
offset >= 0
XMLParseException
- If an error occured while parsing the string.public void parseString(String string, int offset, int end) throws XMLParseException
offset
- The first character in string
to scan.end
- The character where to stop scanning.
This character is not scanned.
string != null
end <= string.length()
offset < end
offset >= 0
XMLParseException
- If an error occured while parsing the string.public void parseString(String string, int offset, int end, int startingLineNr) throws XMLParseException
offset
- The first character in string
to scan.end
- The character where to stop scanning.
This character is not scanned.startingLineNr
- The line number of the first line in the data.
string != null
end <= string.length()
offset < end
offset >= 0
XMLParseException
- If an error occured while parsing the string.public void parseCharArray(char[] input, int offset, int end) throws XMLParseException
offset
- The first character in string
to scan.end
- The character where to stop scanning.
This character is not scanned.
input != null
end <= input.length
offset < end
offset >= 0
XMLParseException
- If an error occured while parsing the string.public void parseCharArray(char[] input, int offset, int end, int startingLineNr) throws XMLParseException
offset
- The first character in string
to scan.end
- The character where to stop scanning.
This character is not scanned.startingLineNr
- The line number of the first line in the data.
input != null
end <= input.length
offset < end
offset >= 0
XMLParseException
- If an error occured while parsing the string.public void removeChild(XMLElement child)
child
- The child element to remove.
child != null
child
is a child element of the receiver
addChild(XMLElement)
,
countChildren()
,
enumerateChildren()
,
getChildren()
public void removeAttribute(String name)
name
- The name of the attribute.
name != null
name
is a valid XML identifier
null
enumerateAttributeNames()
,
setDoubleAttribute(String, double)
,
setIntAttribute(String, int)
,
setAttribute(String, Object)
,
getAttribute(String)
,
getAttribute(String, Object)
,
getAttribute(String, Hashtable, String, boolean)
,
getStringAttribute(String)
,
getStringAttribute(String, String)
,
getStringAttribute(String, Hashtable, String, boolean)
,
getIntAttribute(String)
,
getIntAttribute(String, int)
,
getIntAttribute(String, Hashtable, String, boolean)
,
getDoubleAttribute(String)
,
getDoubleAttribute(String, double)
,
getDoubleAttribute(String, Hashtable, String, boolean)
,
getBooleanAttribute(String, String, String, boolean)
public void removeProperty(String name)
removeAttribute
instead.
name
- The name of the attribute.public void removeChild(String name)
removeAttribute
instead.
name
- The name of the attribute.protected XMLElement createAnotherElement()
You should override this method when subclassing XMLElement.
public void setContent(String content)
content
- The new content string.public void setTagName(String name)
setName
instead.
name
- The new name.public void setName(String name)
name
- The new name.
name != null
name
is a valid XML identifier
getName()
public String toString()
write(Writer)
public void write(Writer writer) throws IOException
writer
- The writer to write the XML data to.
writer != null
writer
is not closed
IOException
- If the data could not be written to the writer.toString()
protected void writeEncoded(Writer writer, String str) throws IOException
writer
- The writer to write the XML data to.str
- The string to write encoded.
writer != null
writer
is not closed
str != null
IOException
protected void scanIdentifier(StringBuffer result) throws IOException
result
.
result
- The buffer in which the scanned identifier will be put.
result != null
IOException
protected char scanWhitespace() throws IOException
IOException
protected char scanWhitespace(StringBuffer result) throws IOException
result
.
result != null
IOException
protected void scanString(StringBuffer string) throws IOException
string
.
string != null
IOException
protected void scanPCData(StringBuffer data) throws IOException
data
.
data != null
IOException
protected boolean checkCDATA(StringBuffer buf) throws IOException
buf
.
buf != null
IOException
protected void skipComment() throws IOException
IOException
protected void skipSpecialTag(int bracketLevel) throws IOException
bracketLevel
- The number of open square brackets ([) that have
already been read.
bracketLevel >= 0
IOException
protected boolean checkLiteral(String literal) throws IOException
literal
- the literal to check.
literal != null
IOException
protected char readChar() throws IOException
IOException
protected void scanElement(XMLElement elt) throws IOException
elt
- The element that will contain the result.
elt != null
IOException
protected void resolveEntity(StringBuffer buf) throws IOException
buf
.
buf
- Where to put the entity value.
buf != null
IOException
protected void unreadChar(char ch)
ch
- The character to push back.
ch != '\0'
protected XMLParseException invalidValueSet(String name)
name
- The name of the entity.
name != null
protected XMLParseException invalidValue(String name, String value)
name
- The name of the entity.value
- The value of the entity.
name != null
value != null
protected XMLParseException unexpectedEndOfData()
protected XMLParseException syntaxError(String context)
context
- The context in which the error occured.
context != null
context.length() > 0
protected XMLParseException expectedInput(String charSet)
charSet
- The set of characters (in human readable form) that was
expected.
charSet != null
charSet.length() > 0
protected XMLParseException unknownEntity(String name)
name
- The name of the entity.
name != null
name.length() > 0
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |