|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnanoxml.kXMLElement
public class kXMLElement
kXMLElement is a representation of an XML object. The object is able to parse XML code.
Note that NanoXML is not 100% XML 1.0 compliant:
<!ENTITY...>
.
You can opt to use a SAX compatible API, by including both
nanoxml.jar
and nanoxml-sax.jar
in your classpath
and setting the property org.xml.sax.parser
to
nanoxml.sax.SAXParser
$Revision: 1.1 $
$Date: 2007/05/09 15:54:52 $
XMLParseException
Nested Class Summary | |
---|---|
static class |
kXMLElement.FakeProperties
|
Field Summary | |
---|---|
static int |
NANOXML_MAJOR_VERSION
Major version of NanoXML. |
static int |
NANOXML_MINOR_VERSION
Minor version of NanoXML. |
Constructor Summary | |
---|---|
|
kXMLElement()
Creates a new XML element. |
|
kXMLElement(boolean skipLeadingWhitespace)
Creates a new XML element. |
|
kXMLElement(kXMLElement.FakeProperties conversionTable)
Creates a new XML element. |
|
kXMLElement(kXMLElement.FakeProperties conversionTable,
boolean skipLeadingWhitespace)
Creates a new XML element. |
|
kXMLElement(kXMLElement.FakeProperties conversionTable,
boolean skipLeadingWhitespace,
boolean ignoreCase)
Creates a new XML element. |
protected |
kXMLElement(kXMLElement.FakeProperties conversionTable,
boolean skipLeadingWhitespace,
boolean fillBasicConversionTable,
boolean ignoreCase)
Creates a new XML element. |
Method Summary | |
---|---|
void |
addChild(kXMLElement child)
Adds a subobject. |
void |
addProperty(java.lang.String key,
int value)
Adds a property. |
void |
addProperty(java.lang.String key,
java.lang.Object value)
Adds a property. |
int |
countChildren()
Returns the number of subobjects of the object. |
protected kXMLElement |
createAnotherElement()
Creates a new XML element. |
protected java.lang.String |
decodeString(java.lang.String s,
int lineNr)
Converts &...; sequences to "normal" chars. |
java.util.Enumeration |
enumerateChildren()
Enumerates the subobjects of the object. |
java.util.Enumeration |
enumeratePropertyNames()
Enumerates the attribute names. |
java.util.Vector |
getChildren()
Returns the subobjects of the object. |
java.lang.String |
getContents()
Returns the #PCDATA content of the object. |
int |
getIntProperty(java.lang.String key,
java.util.Hashtable valueSet,
java.lang.String defaultValue)
Returns a property by looking up a key in a hashtable. |
int |
getLineNr()
Returns the line nr on which the element is found. |
java.lang.String |
getProperty(java.lang.String key)
Returns a property of the object. |
java.lang.Object |
getProperty(java.lang.String key,
java.util.Hashtable valueSet,
java.lang.String defaultValue)
Returns a property by looking up a key in the hashtable valueSet If the property doesn't exist, the value corresponding to defaultValue is returned. |
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. |
boolean |
getProperty(java.lang.String key,
java.lang.String trueValue,
java.lang.String falseValue,
boolean defaultValue)
Returns a boolean property of the object. |
int |
getSpecialIntProperty(java.lang.String key,
java.util.Hashtable valueSet,
java.lang.String defaultValue)
Returns a property by looking up a key in the hashtable valueSet. |
java.lang.String |
getStringProperty(java.lang.String key,
java.util.Hashtable valueSet,
java.lang.String defaultValue)
Returns a property by looking up a key in the hashtable valueSet. |
java.lang.String |
getTagName()
Returns the class (i.e. the name indicated in the tag) of the object. |
int |
parseCharArray(char[] input,
int offset,
int end)
Parses an XML definition starting at offset. |
int |
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. |
int |
parseString(java.lang.String string,
int offset)
Parses an XML definition starting at offset. |
int |
parseString(java.lang.String string,
int offset,
int end)
Parses an XML definition starting at offset. |
int |
parseString(java.lang.String string,
int offset,
int end,
int startingLineNr)
Parses an XML definition starting at offset. |
void |
removeChild(kXMLElement child)
Removes a child object. |
void |
removeChild(java.lang.String key)
Removes an attribute. |
protected void |
scanChildren(char[] input,
int contentOffset,
int contentSize,
int contentLineNr)
!!! |
void |
setContent(java.lang.String content)
Changes the content string. |
void |
setTagName(java.lang.String tagName)
Changes the tag name. |
protected int |
skipBogusTag(char[] input,
int offset,
int end,
int[] lineNr)
Skips a tag that don't contain any useful data: <?...? |
java.lang.String |
toString()
Writes the XML element to a string. |
void |
write(java.io.Writer writer)
Writes the XML element to a writer. |
void |
write(java.io.Writer writer,
int indent)
Writes the XML element to a writer. |
protected void |
writeEncoded(nanoxml.kXMLElement.FakePrintWriter out,
java.lang.String str)
Writes a string encoded to a writer. |
Methods inherited from class java.lang.Object |
---|
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 kXMLElement()
& < >
' "
false
true
kXMLElement(FakeProperties)
,
kXMLElement(boolean)
,
kXMLElement(FakeProperties,boolean)
public kXMLElement(kXMLElement.FakeProperties conversionTable)
& < >
' "
false
true
kXMLElement()
,
kXMLElement(boolean)
,
kXMLElement(FakeProperties,boolean)
public kXMLElement(boolean skipLeadingWhitespace)
& < >
' "
true
kXMLElement()
,
kXMLElement(FakeProperties)
,
kXMLElement(FakeProperties,boolean)
public kXMLElement(kXMLElement.FakeProperties conversionTable, boolean skipLeadingWhitespace)
& < >
' "
true
kXMLElement()
,
kXMLElement(boolean)
,
kXMLElement(FakeProperties)
public kXMLElement(kXMLElement.FakeProperties conversionTable, boolean skipLeadingWhitespace, boolean ignoreCase)
& < >
' "
(depending on fillBasicConversionTable)This constructor should only be called from kXMLElement itself to create child elements.
kXMLElement()
,
kXMLElement(boolean)
,
kXMLElement(FakeProperties)
,
kXMLElement(FakeProperties,boolean)
protected kXMLElement(kXMLElement.FakeProperties conversionTable, boolean skipLeadingWhitespace, boolean fillBasicConversionTable, boolean ignoreCase)
& < >
' "
(depending on fillBasicConversionTable)This constructor should only be called from kXMLElement itself to create child elements.
kXMLElement()
,
kXMLElement(boolean)
,
kXMLElement(FakeProperties)
,
kXMLElement(FakeProperties,boolean)
Method Detail |
---|
public void addChild(kXMLElement child)
public void addProperty(java.lang.String key, java.lang.Object value)
public void addProperty(java.lang.String key, int value)
public int countChildren()
public java.util.Enumeration enumeratePropertyNames()
public java.util.Enumeration enumerateChildren()
public java.util.Vector getChildren()
public java.lang.String getContents()
null
is returned.
public int getLineNr()
public int getIntProperty(java.lang.String key, java.util.Hashtable valueSet, java.lang.String defaultValue)
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 boolean getProperty(java.lang.String key, java.lang.String trueValue, java.lang.String falseValue, boolean defaultValue)
public java.lang.Object getProperty(java.lang.String key, java.util.Hashtable valueSet, java.lang.String defaultValue)
public java.lang.String getStringProperty(java.lang.String key, java.util.Hashtable valueSet, java.lang.String defaultValue)
public int getSpecialIntProperty(java.lang.String key, java.util.Hashtable valueSet, java.lang.String defaultValue)
public java.lang.String getTagName()
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 int parseString(java.lang.String string, int offset) throws XMLParseException
XMLParseException
- if an error occured while parsing the stringpublic int parseString(java.lang.String string, int offset, int end) throws XMLParseException
XMLParseException
- if an error occured while parsing the stringpublic int parseString(java.lang.String string, int offset, int end, int startingLineNr) throws XMLParseException
XMLParseException
- if an error occured while parsing the stringpublic int parseCharArray(char[] input, int offset, int end) throws XMLParseException
XMLParseException
- if an error occured while parsing the arraypublic int parseCharArray(char[] input, int offset, int end, int startingLineNr) throws XMLParseException
XMLParseException
- if an error occured while parsing the arraypublic void removeChild(kXMLElement child)
public void removeChild(java.lang.String key)
protected void scanChildren(char[] input, int contentOffset, int contentSize, int contentLineNr) throws XMLParseException
null
.
XMLParseException
- if an error occured while parsing the arrayparseCharArray(char[], int, int)
protected kXMLElement createAnotherElement()
public void setContent(java.lang.String content)
content
- The new content string.public void setTagName(java.lang.String tagName)
tagName
- The new tag name.protected int skipBogusTag(char[] input, int offset, int end, int[] lineNr)
XMLParseException
- if an error occured while parsing the arrayprotected java.lang.String decodeString(java.lang.String s, int lineNr)
public java.lang.String toString()
toString
in class java.lang.Object
public void write(java.io.Writer writer)
public void write(java.io.Writer writer, int indent)
protected void writeEncoded(nanoxml.kXMLElement.FakePrintWriter out, java.lang.String str)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |