freemind.main
public class XMLElement extends Object
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.
Version: $Name: FM-0-7-1 $, $Revision: 1.7 $
See Also: nanoxml.XMLParseException
Field Summary | |
---|---|
protected boolean | ignoreCasetrue if the case of the element and attribute names
are case insensitive. |
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(Hashtable entities)
Creates and initializes a new XML element.
| |
XMLElement(boolean skipLeadingWhitespace)
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, Object value)
Adds or modifies an attribute.
|
void | addProperty(String key, int value)
Adds or modifies an attribute.
|
void | addProperty(String name, double value)
Adds or modifies an attribute.
|
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.
|
protected void | completeElement() |
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()
Enumerates the attribute names.
|
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, Object defaultValue)
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.
|
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()
Returns the PCDATA content of the object. |
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, int defaultValue)
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 | getIntProperty(String name, Hashtable valueSet, String defaultKey)
Returns an attribute by looking up a key in a hashtable.
|
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)
Returns an attribute.
|
String | getProperty(String name, String defaultValue)
Returns an attribute.
|
int | getProperty(String name, int defaultValue)
Returns an attribute.
|
double | getProperty(String name, double defaultValue)
Returns an attribute.
|
boolean | getProperty(String key, String trueValue, String falseValue, boolean defaultValue)
Returns an attribute.
|
Object | getProperty(String name, Hashtable valueSet, String defaultKey)
Returns an attribute by looking up a key in a hashtable.
|
double | getSpecialDoubleProperty(String name, Hashtable valueSet, String defaultKey)
Returns an attribute by looking up a key in a hashtable.
|
int | getSpecialIntProperty(String name, Hashtable valueSet, String defaultKey)
Returns an attribute by looking up a key in a hashtable.
|
String | getStringAttribute(String name)
Returns an attribute of the element.
|
String | getStringAttribute(String name, String defaultValue)
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 | getStringProperty(String name, Hashtable valueSet, String defaultKey)
Returns an attribute by looking up a key in a hashtable.
|
String | getTagName()
Returns the name of the element.
|
Object | getUserObject() |
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(XMLElement child)
Removes a child element.
|
void | removeChild(String name)
Removes an attribute.
|
void | removeProperty(String name)
Removes an attribute.
|
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)
Changes the name of the element.
|
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.
|
void | write(Writer writer, boolean withClosingTag) |
void | writeClosingTag(Writer writer) |
protected void | writeEncoded(Writer writer, String str)
Writes a string encoded to a writer.
|
void | writeWithoutClosingTag(Writer writer) |
true
if the case of the element and attribute names
are case insensitive.See Also: nanoxml.XMLElement#NANOXML_MINOR_VERSION
See Also: nanoxml.XMLElement#NANOXML_MAJOR_VERSION
new XMLElement(new Hashtable(), false, true)
See Also: nanoxml.XMLElement#XMLElement(java.util.Hashtable)
XMLElement(Hashtable)
nanoxml.XMLElement#XMLElement(boolean) nanoxml.XMLElement#XMLElement(java.util.Hashtable,boolean)
XMLElement(Hashtable, boolean)
new XMLElement(entities, false, true)
Parameters: entities
The entity conversion table.
entities != null
See Also: nanoxml.XMLElement#XMLElement() nanoxml.XMLElement#XMLElement(boolean) nanoxml.XMLElement#XMLElement(java.util.Hashtable,boolean)
XMLElement(Hashtable, boolean)
new XMLElement(new Hashtable(), skipLeadingWhitespace, true)
Parameters: skipLeadingWhitespace
true
if leading and trailing whitespace in PCDATA
content has to be removed.
See Also: nanoxml.XMLElement#XMLElement() nanoxml.XMLElement#XMLElement(java.util.Hashtable)
XMLElement(Hashtable)
nanoxml.XMLElement#XMLElement(java.util.Hashtable,boolean)
XMLElement(Hashtable, boolean)
new XMLElement(entities, skipLeadingWhitespace, true)
Parameters: entities
The entity conversion table. skipLeadingWhitespace
true
if leading and trailing whitespace in PCDATA
content has to be removed.
entities != null
See Also: nanoxml.XMLElement#XMLElement() nanoxml.XMLElement#XMLElement(boolean) nanoxml.XMLElement#XMLElement(java.util.Hashtable)
XMLElement(Hashtable)
Parameters: 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
See Also: nanoxml.XMLElement#XMLElement() nanoxml.XMLElement#XMLElement(boolean) nanoxml.XMLElement#XMLElement(java.util.Hashtable)
XMLElement(Hashtable)
nanoxml.XMLElement#XMLElement(java.util.Hashtable,boolean)
XMLElement(Hashtable, boolean)
This constructor should only be called from
createAnotherElement
to create child elements.
Parameters: 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
See Also: nanoxml.XMLElement#createAnotherElement()
Parameters: child
The child element to add.
child != null
child.getName() != null
child
does not have a parent element
See Also: nanoxml.XMLElement#countChildren() nanoxml.XMLElement#enumerateChildren() nanoxml.XMLElement#getChildren() nanoxml.XMLElement#removeChild(nanoxml.XMLElement)
removeChild(XMLElement)
Deprecated: Use
setAttribute
instead.
Parameters: name The name of the attribute. value The value of the attribute.
Deprecated: Use
setIntAttribute
instead.
Parameters: name The name of the attribute. value The value of the attribute.
Deprecated: Use
setDoubleAttribute
instead.
Parameters: name The name of the attribute. value The value of the attribute.
buf
.
buf != null
Parameters: literal the literal to check.
literal != null
result >= 0
See Also: nanoxml.XMLElement#addChild(nanoxml.XMLElement)
addChild(XMLElement)
nanoxml.XMLElement#enumerateChildren() nanoxml.XMLElement#getChildren() nanoxml.XMLElement#removeChild(nanoxml.XMLElement)
removeChild(XMLElement)
You should override this method when subclassing XMLElement.
result != null
See Also: nanoxml.XMLElement#setDoubleAttribute(java.lang.String, double)
setDoubleAttribute(String, double)
nanoxml.XMLElement#setIntAttribute(java.lang.String, int)
setIntAttribute(String, int)
nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#getAttribute(java.lang.String)
getAttribute(String)
nanoxml.XMLElement#getAttribute(java.lang.String, java.lang.Object)
getAttribute(String, String)
nanoxml.XMLElement#getAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getStringAttribute(java.lang.String)
getStringAttribute(String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.lang.String)
getStringAttribute(String, String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getStringAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getIntAttribute(java.lang.String)
getIntAttribute(String)
nanoxml.XMLElement#getIntAttribute(java.lang.String, int)
getIntAttribute(String, int)
nanoxml.XMLElement#getIntAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getIntAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String)
getDoubleAttribute(String)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String, double)
getDoubleAttribute(String, double)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getDoubleAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getBooleanAttribute(java.lang.String,
java.lang.String,
java.lang.String, boolean)
getBooleanAttribute(String, String, String, boolean)
result != null
See Also: nanoxml.XMLElement#addChild(nanoxml.XMLElement)
addChild(XMLElement)
nanoxml.XMLElement#countChildren() nanoxml.XMLElement#getChildren() nanoxml.XMLElement#removeChild(nanoxml.XMLElement)
removeChild(XMLElement)
Deprecated: Use
enumerateAttributeNames
instead.
Parameters: charSet The set of characters (in human readable form) that was
expected.
charSet != null
charSet.length() > 0
null
is returned.
Parameters: name The name of the attribute.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getAttribute(java.lang.String, java.lang.Object)
getAttribute(String, Object)
nanoxml.XMLElement#getAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getAttribute(String, Hashtable, String, boolean)
defaultValue
is returned.
Parameters: name The name of the attribute. defaultValue Key to use if the attribute is missing.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getAttribute(java.lang.String)
getAttribute(String)
nanoxml.XMLElement#getAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getAttribute(String, Hashtable, String, boolean)
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"
.
Parameters: 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
See Also: nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getAttribute(java.lang.String)
getAttribute(String)
nanoxml.XMLElement#getAttribute(java.lang.String, java.lang.Object)
getAttribute(String, Object)
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.
Parameters: 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.
See Also: nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames()
result != null
See Also: nanoxml.XMLElement#addChild(nanoxml.XMLElement)
addChild(XMLElement)
nanoxml.XMLElement#countChildren() nanoxml.XMLElement#enumerateChildren() nanoxml.XMLElement#removeChild(nanoxml.XMLElement)
removeChild(XMLElement)
null
is returned.
See Also: nanoxml.XMLElement#setContent(java.lang.String)
setContent(String)
Deprecated: Use getContent
instead.
null
is returned.
0.0
is returned.
Parameters: name The name of the attribute.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setDoubleAttribute(java.lang.String, double)
setDoubleAttribute(String, double)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getDoubleAttribute(java.lang.String, double)
getDoubleAttribute(String, double)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getDoubleAttribute(String, Hashtable, String, boolean)
defaultValue
is returned.
Parameters: name The name of the attribute. defaultValue Key to use if the attribute is missing.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setDoubleAttribute(java.lang.String, double)
setDoubleAttribute(String, double)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getDoubleAttribute(java.lang.String)
getDoubleAttribute(String)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getDoubleAttribute(String, Hashtable, String, boolean)
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
.
Parameters: 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.
See Also: nanoxml.XMLElement#setDoubleAttribute(java.lang.String, double)
setDoubleAttribute(String, double)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getDoubleAttribute(java.lang.String)
getDoubleAttribute(String)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String, double)
getDoubleAttribute(String, double)
0
is returned.
Parameters: name The name of the attribute.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setIntAttribute(java.lang.String, int)
setIntAttribute(String, int)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getIntAttribute(java.lang.String, int)
getIntAttribute(String, int)
nanoxml.XMLElement#getIntAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getIntAttribute(String, Hashtable, String, boolean)
defaultValue
is returned.
Parameters: name The name of the attribute. defaultValue Key to use if the attribute is missing.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setIntAttribute(java.lang.String, int)
setIntAttribute(String, int)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getIntAttribute(java.lang.String)
getIntAttribute(String)
nanoxml.XMLElement#getIntAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getIntAttribute(String, Hashtable, String, boolean)
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
.
Parameters: 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.
See Also: nanoxml.XMLElement#setIntAttribute(java.lang.String, int)
setIntAttribute(String, int)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getIntAttribute(java.lang.String)
getIntAttribute(String)
nanoxml.XMLElement#getIntAttribute(java.lang.String, int)
getIntAttribute(String, int)
Deprecated: Use
getIntAttribute
instead.
0
there is no associated source data.
result >= 0
See Also: nanoxml.XMLElement#setName(java.lang.String) setName(String)
Deprecated: Use
getStringAttribute
instead.
Deprecated: Use getStringAttribute
instead.
Deprecated: Use
getIntAttribute
instead.
Deprecated: Use
getDoubleAttribute
instead.
Deprecated: Use
getBooleanAttribute
instead.
Deprecated: Use
getAttribute
instead.
Deprecated: Use
getDoubleAttribute
instead.
Deprecated: Use
getIntAttribute
instead.
null
is returned.
Parameters: name The name of the attribute.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.lang.String)
getStringAttribute(String, String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getStringAttribute(String, Hashtable, String, boolean)
defaultValue
is returned.
Parameters: name The name of the attribute. defaultValue Key to use if the attribute is missing.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getStringAttribute(java.lang.String)
getStringAttribute(String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getStringAttribute(String, Hashtable, String, boolean)
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"
.
Parameters: 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
See Also: nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getStringAttribute(java.lang.String)
getStringAttribute(String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.lang.String)
getStringAttribute(String, String)
Deprecated: Use
getStringAttribute
instead.
Deprecated: Use getName
instead.
Parameters: name The name of the entity. value The value of the entity.
name != null
value != null
Parameters: name The name of the entity.
name != null
Parameters: reader
The reader from which to retrieve the XML data. 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
Throws: nanoxml.XMLParseException If an error occured while parsing the string.
Parameters: reader
The reader from which to retrieve the XML data. 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
Throws: nanoxml.XMLParseException If an error occured while parsing the string.
Parameters: reader
The reader from which to retrieve the XML data.
reader != null
reader
is not closed
Throws: java.io.IOException If an error occured while reading the input. nanoxml.XMLParseException If an error occured while parsing the read data.
Parameters: 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
Throws: java.io.IOException If an error occured while reading the input. nanoxml.XMLParseException If an error occured while parsing the read data.
Parameters: reader
The reader from which to retrieve the XML data.
string != null
string.length() > 0
Throws: nanoxml.XMLParseException If an error occured while parsing the string.
Parameters: reader
The reader from which to retrieve the XML data. offset
The first character in string
to scan.
string != null
offset < string.length()
offset >= 0
Throws: nanoxml.XMLParseException If an error occured while parsing the string.
Parameters: reader
The reader from which to retrieve the XML data. 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
Throws: nanoxml.XMLParseException If an error occured while parsing the string.
Parameters: reader
The reader from which to retrieve the XML data. 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
Throws: nanoxml.XMLParseException If an error occured while parsing the string.
Parameters: name
The name of the attribute.
name != null
name
is a valid XML identifier
null
See Also: nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#setDoubleAttribute(java.lang.String, double)
setDoubleAttribute(String, double)
nanoxml.XMLElement#setIntAttribute(java.lang.String, int)
setIntAttribute(String, int)
nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#getAttribute(java.lang.String)
getAttribute(String)
nanoxml.XMLElement#getAttribute(java.lang.String, java.lang.Object)
getAttribute(String, Object)
nanoxml.XMLElement#getAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getStringAttribute(java.lang.String)
getStringAttribute(String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.lang.String)
getStringAttribute(String, String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getStringAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getIntAttribute(java.lang.String)
getIntAttribute(String)
nanoxml.XMLElement#getIntAttribute(java.lang.String, int)
getIntAttribute(String, int)
nanoxml.XMLElement#getIntAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getIntAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String)
getDoubleAttribute(String)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String, double)
getDoubleAttribute(String, double)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getDoubleAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getBooleanAttribute(java.lang.String,
java.lang.String,
java.lang.String, boolean)
getBooleanAttribute(String, String, String, boolean)
Parameters: child
The child element to remove.
child != null
child
is a child element of the receiver
See Also: nanoxml.XMLElement#addChild(nanoxml.XMLElement)
addChild(XMLElement)
nanoxml.XMLElement#countChildren() nanoxml.XMLElement#enumerateChildren() nanoxml.XMLElement#getChildren()
Deprecated: Use
removeAttribute
instead.
Parameters: name The name of the attribute.
Deprecated: Use
removeAttribute
instead.
Parameters: name The name of the attribute.
buf
.
Parameters: buf Where to put the entity value.
buf != null
Parameters: elt The element that will contain the result.
elt != null
result
.
Parameters: result
The buffer in which the scanned identifier will be put.
result != null
data
.
data != null
string
.
string != null
Returns: the next character following the whitespace.
result
.
Returns: the next character following the whitespace.
result != null
Parameters: name
The name of the attribute. value
The value of the attribute.
name != null
name
is a valid XML identifier
value != null
See Also: nanoxml.XMLElement#setDoubleAttribute(java.lang.String, double)
setDoubleAttribute(String, double)
nanoxml.XMLElement#setIntAttribute(java.lang.String, int)
setIntAttribute(String, int)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getAttribute(java.lang.String)
getAttribute(String)
nanoxml.XMLElement#getAttribute(java.lang.String, java.lang.Object)
getAttribute(String, Object)
nanoxml.XMLElement#getAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getAttribute(String, Hashtable, String, boolean)
nanoxml.XMLElement#getStringAttribute(java.lang.String)
getStringAttribute(String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.lang.String)
getStringAttribute(String, String)
nanoxml.XMLElement#getStringAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getStringAttribute(String, Hashtable, String, boolean)
Parameters: content The new content string.
Parameters: name
The name of the attribute. value
The value of the attribute.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setIntAttribute(java.lang.String, int)
setIntAttribute(String, int)
nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getDoubleAttribute(java.lang.String)
getDoubleAttribute(String)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String, double)
getDoubleAttribute(String, double)
nanoxml.XMLElement#getDoubleAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getDoubleAttribute(String, Hashtable, String, boolean)
Parameters: name
The name of the attribute. value
The value of the attribute.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#setDoubleAttribute(java.lang.String, double)
setDoubleAttribute(String, double)
nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
setAttribute(String, Object)
nanoxml.XMLElement#removeAttribute(java.lang.String)
removeAttribute(String)
nanoxml.XMLElement#enumerateAttributeNames() nanoxml.XMLElement#getIntAttribute(java.lang.String)
getIntAttribute(String)
nanoxml.XMLElement#getIntAttribute(java.lang.String, int)
getIntAttribute(String, int)
nanoxml.XMLElement#getIntAttribute(java.lang.String,
java.util.Hashtable,
java.lang.String, boolean)
getIntAttribute(String, Hashtable, String, boolean)
Parameters: name
The new name.
name != null
name
is a valid XML identifier
See Also: nanoxml.XMLElement#getName()
Deprecated: Use setName
instead.
Parameters: name The new name.
Parameters: bracketLevel The number of open square brackets ([) that have
already been read.
bracketLevel >= 0
Parameters: context The context in which the error occured.
context != null
context.length() > 0
See Also: nanoxml.XMLElement#write(java.io.Writer) write(Writer)
Parameters: name The name of the entity.
name != null
name.length() > 0
Parameters: ch The character to push back.
ch != '\0'
Parameters: writer
The writer to write the XML data to.
writer != null
writer
is not closed
Throws: java.io.IOException If the data could not be written to the writer.
See Also: nanoxml.XMLElement#toString()
Parameters: writer
The writer to write the XML data to. str
The string to write encoded.
writer != null
writer
is not closed
str != null