Java Doc for XMLElement.java in  » Swing-Library » jide-common » com » jidesoft » plaf » aqua » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Swing Library » jide common » com.jidesoft.plaf.aqua 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jidesoft.plaf.aqua.XMLElement

XMLElement
class XMLElement (Code)
XMLElement is a representation of an XML object. The object is able to parse XML code.

Parsing XML Data
You can parse XML data using the following code:
    XMLElement xml = new XMLElement();
    FileReader reader = new FileReader("filename.xml");
    xml.parseFromReader(reader);
Retrieving Attributes
You can enumerate the attributes of an element using the method XMLElement.enumerateAttributeNames() enumerateAttributeNames . The attribute values can be retrieved using the method XMLElement.getStringAttribute(String) getStringAttribute . The following example shows how to list the attributes of an element:
    XMLElement element = ...;
    Iterator iter = element.getAttributeNames();
    while (iter.hasNext()) {
        String key = (String) iter.next();
        String value = element.getStringAttribute(key);
        System.out.println(key + " = " + value);
    }
Retrieving Child Elements
You can enumerate the children of an element using XMLElement.iterateChildren() iterateChildren . The number of child iterator can be retrieved using XMLElement.countChildren() countChildren .
Elements Containing Character Data
If an iterator contains character data, like in the following example:
    <title>The Title</title>
you can retrieve that data using the method XMLElement.getContent() getContent .
Subclassing XMLElement
When subclassing XMLElement, you need to override the method XMLElement.createAnotherElement() createAnotherElement which has to return a new copy of the receiver.


author:
   Marc De Scheemaecker
author:
   <cyberelf@mac.com>
version:
   2005-06-18 Werner Randelshofer: Adapted for Java 2 Collections API.
version:
  
$Name: RELEASE_2_2_1 $, $Revision: 1.4 $
See Also:   XMLParseException



Field Summary
final public static  intNANOXML_MAJOR_VERSION
     Major version of NanoXML.
final public static  intNANOXML_MINOR_VERSION
     Minor version of NanoXML.
final static  longserialVersionUID
     Serialization serial version ID.

Constructor Summary
public  XMLElement()
     Creates and initializes a new XML element.
public  XMLElement(HashMap entities)
     Creates and initializes a new XML element.
public  XMLElement(boolean skipLeadingWhitespace)
     Creates and initializes a new XML element.
public  XMLElement(HashMap entities, boolean skipLeadingWhitespace)
     Creates and initializes a new XML element.
public  XMLElement(HashMap entities, boolean skipLeadingWhitespace, boolean ignoreCase)
     Creates and initializes a new XML element.
protected  XMLElement(HashMap entities, boolean skipLeadingWhitespace, boolean fillBasicConversionTable, boolean ignoreCase)
     Creates and initializes a new XML element.

Method Summary
public  voidaddChild(XMLElement child)
     Adds a child element.
public  voidaddProperty(String name, Object value)
     Adds or modifies an attribute.
public  voidaddProperty(String key, int value)
     Adds or modifies an attribute.
public  voidaddProperty(String name, double value)
     Adds or modifies an attribute.
protected  booleancheckCDATA(StringBuffer buf)
     Scans a special tag and if the tag is a CDATA section, append its content to buf.
protected  booleancheckLiteral(String literal)
     Scans the data for literal text.
public  intcountChildren()
     Returns the number of child iterator of the element.
public  XMLElementcreateAnotherElement()
     Creates a new similar XML element.
public  IteratorenumerateAttributeNames()
     Enumerates the attribute names.
public  IteratorenumeratePropertyNames()
     Enumerates the attribute names.
protected  XMLParseExceptionexpectedInput(String charSet)
     Creates a parse exception for when the next character read is not the character that was expected.
public  ObjectgetAttribute(String name)
     Returns an attribute of the element.
public  ObjectgetAttribute(String name, Object defaultValue)
     Returns an attribute of the element.
public  ObjectgetAttribute(String name, HashMap valueSet, String defaultKey, boolean allowLiterals)
     Returns an attribute by looking up a key in a hashtable.
public  booleangetBooleanAttribute(String name, String trueValue, String falseValue, boolean defaultValue)
     Returns an attribute of the element.
public  ArrayListgetChildren()
     Returns the child iterator as a ArrayList.
public  StringgetContent()
     Returns the PCDATA content of the object.
public  StringgetContents()
     Returns the PCDATA content of the object.
public  doublegetDoubleAttribute(String name)
     Returns an attribute of the element.
public  doublegetDoubleAttribute(String name, double defaultValue)
     Returns an attribute of the element.
public  doublegetDoubleAttribute(String name, HashMap valueSet, String defaultKey, boolean allowLiteralNumbers)
     Returns an attribute by looking up a key in a hashtable.
public  intgetIntAttribute(String name)
     Returns an attribute of the element.
public  intgetIntAttribute(String name, int defaultValue)
     Returns an attribute of the element.
public  intgetIntAttribute(String name, HashMap valueSet, String defaultKey, boolean allowLiteralNumbers)
     Returns an attribute by looking up a key in a hashtable.
public  intgetIntProperty(String name, HashMap valueSet, String defaultKey)
     Returns an attribute by looking up a key in a hashtable.
public  intgetLineNr()
     Returns the line nr in the source data on which the element is found.
public  StringgetName()
     Returns the name of the element.
public  StringgetProperty(String name)
     Returns an attribute.
public  StringgetProperty(String name, String defaultValue)
     Returns an attribute.
public  intgetProperty(String name, int defaultValue)
     Returns an attribute.
public  doublegetProperty(String name, double defaultValue)
     Returns an attribute.
public  booleangetProperty(String key, String trueValue, String falseValue, boolean defaultValue)
     Returns an attribute.
public  ObjectgetProperty(String name, HashMap valueSet, String defaultKey)
     Returns an attribute by looking up a key in a hashtable.
public  doublegetSpecialDoubleProperty(String name, HashMap valueSet, String defaultKey)
     Returns an attribute by looking up a key in a hashtable.
public  intgetSpecialIntProperty(String name, HashMap valueSet, String defaultKey)
     Returns an attribute by looking up a key in a hashtable.
public  StringgetStringAttribute(String name)
     Returns an attribute of the element.
public  StringgetStringAttribute(String name, String defaultValue)
     Returns an attribute of the element.
public  StringgetStringAttribute(String name, HashMap valueSet, String defaultKey, boolean allowLiterals)
     Returns an attribute by looking up a key in a hashtable.
public  StringgetStringProperty(String name, HashMap valueSet, String defaultKey)
     Returns an attribute by looking up a key in a hashtable.
public  StringgetTagName()
     Returns the name of the element.
protected  XMLParseExceptioninvalidValue(String name, String value)
     Creates a parse exception for when an invalid value is given to a method.
protected  XMLParseExceptioninvalidValueSet(String name)
     Creates a parse exception for when an invalid valueset is given to a method.
public  IteratoriterateChildren()
     Enumerates the child iterator.
public  voidparseCharArray(char[] input, int offset, int end)
     Reads one XML element from a char array and parses it.
public  voidparseCharArray(char[] input, int offset, int end, int startingLineNr)
     Reads one XML element from a char array and parses it.
public  voidparseFromReader(Reader reader)
     Reads one XML element from a java.io.Reader and parses it.
public  voidparseFromReader(Reader reader, int startingLineNr)
     Reads one XML element from a java.io.Reader and parses it.
public  voidparseString(String string)
     Reads one XML element from a String and parses it.
public  voidparseString(String string, int offset)
     Reads one XML element from a String and parses it.
public  voidparseString(String string, int offset, int end)
     Reads one XML element from a String and parses it.
public  voidparseString(String string, int offset, int end, int startingLineNr)
     Reads one XML element from a String and parses it.
protected  charreadChar()
     Reads a character from a reader.
public  voidremoveAttribute(String name)
     Removes an attribute.
public  voidremoveChild(XMLElement child)
     Removes a child element.
public  voidremoveChild(String name)
     Removes an attribute.
public  voidremoveProperty(String name)
     Removes an attribute.
protected  voidresolveEntity(StringBuffer buf)
     Resolves an entity.
protected  voidscanElement(XMLElement elt)
     Scans an XML element.
protected  voidscanIdentifier(StringBuffer result)
     Scans an identifier from the current reader.
protected  voidscanPCData(StringBuffer data)
     Scans a #PCDATA element.
protected  voidscanString(StringBuffer string)
     This method scans a delimited string from the current reader.
protected  charscanWhitespace()
     This method scans an identifier from the current reader.
protected  charscanWhitespace(StringBuffer result)
     This method scans an identifier from the current reader.
public  voidsetAttribute(String name, Object value)
     Adds or modifies an attribute.
public  voidsetContent(String content)
     Changes the content string.
public  voidsetDoubleAttribute(String name, double value)
     Adds or modifies an attribute.
public  voidsetIntAttribute(String name, int value)
     Adds or modifies an attribute.
public  voidsetName(String name)
     Changes the name of the element.
public  voidsetTagName(String name)
     Changes the name of the element.
protected  voidskipComment()
     Skips a comment.
protected  voidskipSpecialTag(int bracketLevel)
     Skips a special tag or comment.
protected  XMLParseExceptionsyntaxError(String context)
     Creates a parse exception for when a syntax error occured.
public  StringtoString()
     Writes the XML element to a string.
protected  XMLParseExceptionunexpectedEndOfData()
     Creates a parse exception for when the end of the data input has been reached.
protected  XMLParseExceptionunknownEntity(String name)
     Creates a parse exception for when an entity could not be resolved.
protected  voidunreadChar(char ch)
     Pushes a character back to the read-back buffer.
public  voidwrite(Writer writer)
     Writes the XML element to a writer.
protected  voidwriteEncoded(Writer writer, String str)
     Writes a string encoded to a writer.

Field Detail
NANOXML_MAJOR_VERSION
final public static int NANOXML_MAJOR_VERSION(Code)
Major version of NanoXML. Classes with the same major and minor version are binary compatible. Classes with the same major version are source compatible. If the major version is different, you may need to modify the client source code.
See Also:   XMLElement.NANOXML_MINOR_VERSION



NANOXML_MINOR_VERSION
final public static int NANOXML_MINOR_VERSION(Code)
Minor version of NanoXML. Classes with the same major and minor version are binary compatible. Classes with the same major version are source compatible. If the major version is different, you may need to modify the client source code.
See Also:   XMLElement.NANOXML_MAJOR_VERSION



serialVersionUID
final static long serialVersionUID(Code)
Serialization serial version ID.




Constructor Detail
XMLElement
public XMLElement()(Code)
Creates and initializes a new XML element. Calling the construction is equivalent to:
    new XMLElement(new HashMap(), false, true)

Postconditions:
  • countChildren() => 0
  • iterateChildren() => empty enumeration
  • enumeratePropertyNames() => empty enumeration
  • getChildren() => empty vector
  • getContent() => ""
  • getLineNr() => 0
  • getName() => null

See Also:   XMLElement.XMLElement(java.util.HashMap)
See Also:   XMLElement(HashMap)
See Also:   XMLElement.XMLElement(boolean)
See Also:   XMLElement.XMLElement(java.util.HashMapboolean)
See Also:   XMLElement(HashMap, boolean)



XMLElement
public XMLElement(HashMap entities)(Code)
Creates and initializes a new XML element. Calling the construction is equivalent to:
    new XMLElement(entities, false, true)

Parameters:
  entities - The entity conversion table.

Preconditions:
  • entities != null

Postconditions:
  • countChildren() => 0
  • iterateChildren() => empty enumeration
  • enumeratePropertyNames() => empty enumeration
  • getChildren() => empty vector
  • getContent() => ""
  • getLineNr() => 0
  • getName() => null

See Also:   XMLElement.XMLElement
See Also:   XMLElement.XMLElement(boolean)
See Also:   XMLElement.XMLElement(java.util.HashMapboolean)
See Also:   XMLElement(HashMap, boolean)



XMLElement
public XMLElement(boolean skipLeadingWhitespace)(Code)
Creates and initializes a new XML element. Calling the construction is equivalent to:
    new XMLElement(new HashMap(), skipLeadingWhitespace, true)

Parameters:
  skipLeadingWhitespace - true if leading and trailing whitespace in PCDATAcontent has to be removed.

Postconditions:
  • countChildren() => 0
  • iterateChildren() => empty enumeration
  • enumeratePropertyNames() => empty enumeration
  • getChildren() => empty vector
  • getContent() => ""
  • getLineNr() => 0
  • getName() => null

See Also:   XMLElement.XMLElement
See Also:   XMLElement.XMLElement(java.util.HashMap)
See Also:   XMLElement(HashMap)
See Also:   XMLElement.XMLElement(java.util.HashMapboolean)
See Also:   XMLElement(HashMap, boolean)



XMLElement
public XMLElement(HashMap entities, boolean skipLeadingWhitespace)(Code)
Creates and initializes a new XML element. Calling the construction is equivalent to:
    new XMLElement(entities, skipLeadingWhitespace, true)

Parameters:
  entities - The entity conversion table.
Parameters:
  skipLeadingWhitespace - true if leading and trailing whitespace in PCDATAcontent has to be removed.

Preconditions:
  • entities != null

Postconditions:
  • countChildren() => 0
  • iterateChildren() => empty enumeration
  • enumeratePropertyNames() => empty enumeration
  • getChildren() => empty vector
  • getContent() => ""
  • getLineNr() => 0
  • getName() => null

See Also:   XMLElement.XMLElement
See Also:   XMLElement.XMLElement(boolean)
See Also:   XMLElement.XMLElement(java.util.HashMap)
See Also:   XMLElement(HashMap)



XMLElement
public XMLElement(HashMap entities, boolean skipLeadingWhitespace, boolean ignoreCase)(Code)
Creates and initializes a new XML element.
Parameters:
  entities - The entity conversion table.
Parameters:
  skipLeadingWhitespace - true if leading and trailing whitespace in PCDATAcontent has to be removed.
Parameters:
  ignoreCase - true if the case of element and attribute names haveto be ignored.

Preconditions:
  • entities != null

Postconditions:
  • countChildren() => 0
  • iterateChildren() => empty enumeration
  • enumeratePropertyNames() => empty enumeration
  • getChildren() => empty vector
  • getContent() => ""
  • getLineNr() => 0
  • getName() => null

See Also:   XMLElement.XMLElement
See Also:   XMLElement.XMLElement(boolean)
See Also:   XMLElement.XMLElement(java.util.HashMap)
See Also:   XMLElement(HashMap)
See Also:   XMLElement.XMLElement(java.util.HashMapboolean)
See Also:   XMLElement(HashMap, boolean)



XMLElement
protected XMLElement(HashMap entities, boolean skipLeadingWhitespace, boolean fillBasicConversionTable, boolean ignoreCase)(Code)
Creates and initializes a new XML element.

This constructor should only be called from XMLElement.createAnotherElement() createAnotherElement to create child iterator.
Parameters:
  entities - The entity conversion table.
Parameters:
  skipLeadingWhitespace - true if leading and trailing whitespace in PCDATAcontent has to be removed.
Parameters:
  fillBasicConversionTable - true if the basic entities need to be added tothe entity list.
Parameters:
  ignoreCase - true if the case of element and attribute names haveto be ignored.

Preconditions:
  • entities != null
  • if fillBasicConversionTable == falsethen entities contains at least the followingentries: amp, lt, gt,apos and quot

Postconditions:
  • countChildren() => 0
  • iterateChildren() => empty enumeration
  • enumeratePropertyNames() => empty enumeration
  • getChildren() => empty vector
  • getContent() => ""
  • getLineNr() => 0
  • getName() => null

See Also:   XMLElement.createAnotherElement




Method Detail
addChild
public void addChild(XMLElement child)(Code)
Adds a child element.
Parameters:
  child - The child element to add.

Preconditions:
  • child != null
  • child.getName() != null
  • child does not have a parent element

Postconditions:
  • countChildren() => old.countChildren() + 1
  • iterateChildren() => old.iterateChildren() + child
  • getChildren() => old.iterateChildren() + child

See Also:   XMLElement.countChildren
See Also:   XMLElement.iterateChildren
See Also:   XMLElement.getChildren
See Also:   XMLElement.removeChild(XMLElement)
See Also:   removeChild(XMLElement)



addProperty
public void addProperty(String name, Object value)(Code)
Adds or modifies an attribute.
Parameters:
  name - The name of the attribute.
Parameters:
  value - The value of the attribute.XMLElement.setAttribute(String,Object)setAttribute



addProperty
public void addProperty(String key, int value)(Code)
Adds or modifies an attribute.
Parameters:
  key - The name of the attribute.
Parameters:
  value - The value of the attribute.XMLElement.setIntAttribute(String,int)setIntAttribute



addProperty
public void addProperty(String name, double value)(Code)
Adds or modifies an attribute.
Parameters:
  name - The name of the attribute.
Parameters:
  value - The value of the attribute.XMLElement.setDoubleAttribute(String,double)setDoubleAttribute



checkCDATA
protected boolean checkCDATA(StringBuffer buf) throws IOException(Code)
Scans a special tag and if the tag is a CDATA section, append its content to buf.

Preconditions:
  • buf != null
  • The first < has already been read.



checkLiteral
protected boolean checkLiteral(String literal) throws IOException(Code)
Scans the data for literal text. Scanning stops when a character does not match or after the complete text has been checked, whichever comes first.
Parameters:
  literal - the literal to check.

Preconditions:
  • literal != null



countChildren
public int countChildren()(Code)
Returns the number of child iterator of the element.

Postconditions:
  • result >= 0

See Also:   XMLElement.addChild(XMLElement)
See Also:   addChild(XMLElement)
See Also:   XMLElement.iterateChildren
See Also:   XMLElement.getChildren
See Also:   XMLElement.removeChild(XMLElement)
See Also:   removeChild(XMLElement)



createAnotherElement
public XMLElement createAnotherElement()(Code)
Creates a new similar XML element.

You should override this method when subclassing XMLElement.




enumerateAttributeNames
public Iterator enumerateAttributeNames()(Code)
Enumerates the attribute names.

Postconditions:
  • result != null

See Also:   XMLElement.setDoubleAttribute(Stringdouble)
See Also:   setDoubleAttribute(String, double)
See Also:   XMLElement.setIntAttribute(Stringint)
See Also:   setIntAttribute(String, int)
See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.getAttribute(String)
See Also:   getAttribute(String)
See Also:   XMLElement.getAttribute(StringObject)
See Also:   getAttribute(String, String)
See Also:   XMLElement.getAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getStringAttribute(String)
See Also:   getStringAttribute(String)
See Also:   XMLElement.getStringAttribute(StringString)
See Also:   getStringAttribute(String, String)
See Also:   XMLElement.getStringAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getStringAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getIntAttribute(String)
See Also:   getIntAttribute(String)
See Also:   XMLElement.getIntAttribute(Stringint)
See Also:   getIntAttribute(String, int)
See Also:   XMLElement.getIntAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getIntAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getDoubleAttribute(String)
See Also:   getDoubleAttribute(String)
See Also:   XMLElement.getDoubleAttribute(Stringdouble)
See Also:   getDoubleAttribute(String, double)
See Also:   XMLElement.getDoubleAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getDoubleAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getBooleanAttribute(StringStringStringboolean)
See Also:   getBooleanAttribute(String, String, String, boolean)



enumeratePropertyNames
public Iterator enumeratePropertyNames()(Code)
Enumerates the attribute names. XMLElement.enumerateAttributeNames()enumerateAttributeNames



expectedInput
protected XMLParseException expectedInput(String charSet)(Code)
Creates a parse exception for when the next character read is not the character that was expected.
Parameters:
  charSet - The set of characters (in human readable form) that wasexpected.

Preconditions:
  • charSet != null
  • charSet.length() > 0



getAttribute
public Object getAttribute(String name)(Code)
Returns an attribute of the element. If the attribute doesn't exist, null is returned.
Parameters:
  name - The name of the attribute.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getAttribute(StringObject)
See Also:   getAttribute(String, Object)
See Also:   XMLElement.getAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getAttribute(String, HashMap, String, boolean)



getAttribute
public Object getAttribute(String name, Object defaultValue)(Code)
Returns an attribute of the element. If the attribute doesn't exist, defaultValue is returned.
Parameters:
  name - The name of the attribute.
Parameters:
  defaultValue - Key to use if the attribute is missing.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getAttribute(String)
See Also:   getAttribute(String)
See Also:   XMLElement.getAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getAttribute(String, HashMap, String, boolean)



getAttribute
public Object getAttribute(String name, HashMap valueSet, String defaultKey, boolean allowLiterals)(Code)
Returns an attribute by looking up a key in a hashtable. If the attribute doesn't exist, the value corresponding to defaultKey is returned.

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.
Parameters:
  valueSet - HashMap mapping keySet().iterator to values.
Parameters:
  defaultKey - Key to use if the attribute is missing.
Parameters:
  allowLiterals - true if literals are valid.

Preconditions:
  • name != null
  • name is a valid XML identifier
  • valueSet != null
  • the keySet().iterator of valueSet are strings

See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getAttribute(String)
See Also:   getAttribute(String)
See Also:   XMLElement.getAttribute(StringObject)
See Also:   getAttribute(String, Object)



getBooleanAttribute
public boolean getBooleanAttribute(String name, String trueValue, String falseValue, boolean defaultValue)(Code)
Returns an attribute of the element. If the attribute doesn't exist, 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.
Parameters:
  trueValue - The value associated with true.
Parameters:
  falseValue - The value associated with true.
Parameters:
  defaultValue - Value to use if the attribute is missing.

Preconditions:
  • name != null
  • name is a valid XML identifier
  • trueValue and falseValueare different strings.

See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames



getChildren
public ArrayList getChildren()(Code)
Returns the child iterator as a ArrayList. It is safe to modify this ArrayList.

Postconditions:
  • result != null

See Also:   XMLElement.addChild(XMLElement)
See Also:   addChild(XMLElement)
See Also:   XMLElement.countChildren
See Also:   XMLElement.iterateChildren
See Also:   XMLElement.removeChild(XMLElement)
See Also:   removeChild(XMLElement)



getContent
public String getContent()(Code)
Returns the PCDATA content of the object. If there is no such content, null is returned.
See Also:   XMLElement.setContent(String)
See Also:   setContent(String)



getContents
public String getContents()(Code)
Returns the PCDATA content of the object. If there is no such content, null is returned. XMLElement.getContent() getContent



getDoubleAttribute
public double getDoubleAttribute(String name)(Code)
Returns an attribute of the element. If the attribute doesn't exist, 0.0 is returned.
Parameters:
  name - The name of the attribute.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.setDoubleAttribute(Stringdouble)
See Also:   setDoubleAttribute(String, double)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getDoubleAttribute(Stringdouble)
See Also:   getDoubleAttribute(String, double)
See Also:   XMLElement.getDoubleAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getDoubleAttribute(String, HashMap, String, boolean)



getDoubleAttribute
public double getDoubleAttribute(String name, double defaultValue)(Code)
Returns an attribute of the element. If the attribute doesn't exist, defaultValue is returned.
Parameters:
  name - The name of the attribute.
Parameters:
  defaultValue - Key to use if the attribute is missing.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.setDoubleAttribute(Stringdouble)
See Also:   setDoubleAttribute(String, double)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getDoubleAttribute(String)
See Also:   getDoubleAttribute(String)
See Also:   XMLElement.getDoubleAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getDoubleAttribute(String, HashMap, String, boolean)



getDoubleAttribute
public double getDoubleAttribute(String name, HashMap valueSet, String defaultKey, boolean allowLiteralNumbers)(Code)
Returns an attribute by looking up a key in a hashtable. If the attribute doesn't exist, the value corresponding to defaultKey is returned.

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.
Parameters:
  valueSet - HashMap mapping keySet().iterator to values.
Parameters:
  defaultKey - Key to use if the attribute is missing.
Parameters:
  allowLiteralNumbers - true if literal numbers are valid.

Preconditions:
  • name != null
  • name is a valid XML identifier
  • valueSet != null
  • the keySet().iterator of valueSet are strings
  • the values of valueSet are Double objects
  • defaultKey is either null, akey in valueSet or a double.

See Also:   XMLElement.setDoubleAttribute(Stringdouble)
See Also:   setDoubleAttribute(String, double)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getDoubleAttribute(String)
See Also:   getDoubleAttribute(String)
See Also:   XMLElement.getDoubleAttribute(Stringdouble)
See Also:   getDoubleAttribute(String, double)



getIntAttribute
public int getIntAttribute(String name)(Code)
Returns an attribute of the element. If the attribute doesn't exist, 0 is returned.
Parameters:
  name - The name of the attribute.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.setIntAttribute(Stringint)
See Also:   setIntAttribute(String, int)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getIntAttribute(Stringint)
See Also:   getIntAttribute(String, int)
See Also:   XMLElement.getIntAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getIntAttribute(String, HashMap, String, boolean)



getIntAttribute
public int getIntAttribute(String name, int defaultValue)(Code)
Returns an attribute of the element. If the attribute doesn't exist, defaultValue is returned.
Parameters:
  name - The name of the attribute.
Parameters:
  defaultValue - Key to use if the attribute is missing.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.setIntAttribute(Stringint)
See Also:   setIntAttribute(String, int)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getIntAttribute(String)
See Also:   getIntAttribute(String)
See Also:   XMLElement.getIntAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getIntAttribute(String, HashMap, String, boolean)



getIntAttribute
public int getIntAttribute(String name, HashMap valueSet, String defaultKey, boolean allowLiteralNumbers)(Code)
Returns an attribute by looking up a key in a hashtable. If the attribute doesn't exist, the value corresponding to defaultKey is returned.

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.
Parameters:
  valueSet - HashMap mapping keySet().iterator to values.
Parameters:
  defaultKey - Key to use if the attribute is missing.
Parameters:
  allowLiteralNumbers - true if literal numbers are valid.

Preconditions:
  • name != null
  • name is a valid XML identifier
  • valueSet != null
  • the keySet().iterator of valueSet are strings
  • the values of valueSet are Integer objects
  • defaultKey is either null, akey in valueSet or an integer.

See Also:   XMLElement.setIntAttribute(Stringint)
See Also:   setIntAttribute(String, int)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getIntAttribute(String)
See Also:   getIntAttribute(String)
See Also:   XMLElement.getIntAttribute(Stringint)
See Also:   getIntAttribute(String, int)



getIntProperty
public int getIntProperty(String name, HashMap valueSet, String defaultKey)(Code)
Returns an attribute by looking up a key in a hashtable. XMLElement.getIntAttribute(java.lang.String,java.util.HashMap,java.lang.String,boolean)getIntAttribute



getLineNr
public int getLineNr()(Code)
Returns the line nr in the source data on which the element is found. This method returns 0 there is no associated source data.

Postconditions:
  • result >= 0



getName
public String getName()(Code)
Returns the name of the element.
See Also:   XMLElement.setName(java.lang.String)
See Also:    setName(String)



getProperty
public String getProperty(String name)(Code)
Returns an attribute. XMLElement.getStringAttribute(java.lang.String)getStringAttribute



getProperty
public String getProperty(String name, String defaultValue)(Code)
Returns an attribute. XMLElement.getStringAttribute(java.lang.String,java.lang.String) getStringAttribute



getProperty
public int getProperty(String name, int defaultValue)(Code)
Returns an attribute. XMLElement.getIntAttribute(java.lang.String,int)getIntAttribute



getProperty
public double getProperty(String name, double defaultValue)(Code)
Returns an attribute. XMLElement.getDoubleAttribute(java.lang.String,double)getDoubleAttribute



getProperty
public boolean getProperty(String key, String trueValue, String falseValue, boolean defaultValue)(Code)
Returns an attribute. XMLElement.getBooleanAttribute(java.lang.String,java.lang.String,java.lang.String,boolean)getBooleanAttribute



getProperty
public Object getProperty(String name, HashMap valueSet, String defaultKey)(Code)
Returns an attribute by looking up a key in a hashtable. XMLElement.getAttribute(java.lang.String,java.util.HashMap,java.lang.String,boolean)getAttribute



getSpecialDoubleProperty
public double getSpecialDoubleProperty(String name, HashMap valueSet, String defaultKey)(Code)
Returns an attribute by looking up a key in a hashtable. XMLElement.getDoubleAttribute(java.lang.String,java.util.HashMap,java.lang.String,boolean)getDoubleAttribute



getSpecialIntProperty
public int getSpecialIntProperty(String name, HashMap valueSet, String defaultKey)(Code)
Returns an attribute by looking up a key in a hashtable. XMLElement.getIntAttribute(java.lang.String,java.util.HashMap,java.lang.String,boolean)getIntAttribute



getStringAttribute
public String getStringAttribute(String name)(Code)
Returns an attribute of the element. If the attribute doesn't exist, null is returned.
Parameters:
  name - The name of the attribute.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getStringAttribute(StringString)
See Also:   getStringAttribute(String, String)
See Also:   XMLElement.getStringAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getStringAttribute(String, HashMap, String, boolean)



getStringAttribute
public String getStringAttribute(String name, String defaultValue)(Code)
Returns an attribute of the element. If the attribute doesn't exist, defaultValue is returned.
Parameters:
  name - The name of the attribute.
Parameters:
  defaultValue - Key to use if the attribute is missing.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getStringAttribute(String)
See Also:   getStringAttribute(String)
See Also:   XMLElement.getStringAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getStringAttribute(String, HashMap, String, boolean)



getStringAttribute
public String getStringAttribute(String name, HashMap valueSet, String defaultKey, boolean allowLiterals)(Code)
Returns an attribute by looking up a key in a hashtable. If the attribute doesn't exist, the value corresponding to defaultKey is returned.

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.
Parameters:
  valueSet - HashMap mapping keySet().iterator to values.
Parameters:
  defaultKey - Key to use if the attribute is missing.
Parameters:
  allowLiterals - true if literals are valid.

Preconditions:
  • name != null
  • name is a valid XML identifier
  • valueSet != null
  • the keySet().iterator of valueSet are strings
  • the values of valueSet are strings

See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getStringAttribute(String)
See Also:   getStringAttribute(String)
See Also:   XMLElement.getStringAttribute(StringString)
See Also:   getStringAttribute(String, String)



getStringProperty
public String getStringProperty(String name, HashMap valueSet, String defaultKey)(Code)
Returns an attribute by looking up a key in a hashtable. XMLElement.getStringAttribute(java.lang.String,java.util.HashMap,java.lang.String,boolean)getStringAttribute



getTagName
public String getTagName()(Code)
Returns the name of the element. XMLElement.getName() getName



invalidValue
protected XMLParseException invalidValue(String name, String value)(Code)
Creates a parse exception for when an invalid value is given to a method.
Parameters:
  name - The name of the entity.
Parameters:
  value - The value of the entity.

Preconditions:
  • name != null
  • value != null



invalidValueSet
protected XMLParseException invalidValueSet(String name)(Code)
Creates a parse exception for when an invalid valueset is given to a method.
Parameters:
  name - The name of the entity.

Preconditions:
  • name != null



iterateChildren
public Iterator iterateChildren()(Code)
Enumerates the child iterator.

Postconditions:
  • result != null

See Also:   XMLElement.addChild(XMLElement)
See Also:   addChild(XMLElement)
See Also:   XMLElement.countChildren
See Also:   XMLElement.getChildren
See Also:   XMLElement.removeChild(XMLElement)
See Also:   removeChild(XMLElement)



parseCharArray
public void parseCharArray(char[] input, int offset, int end) throws XMLParseException(Code)
Reads one XML element from a char array and parses it.
Parameters:
  input - The reader from which to retrieve the XML data.
Parameters:
  offset - The first character in string to scan.
Parameters:
  end - The character where to stop scanning.This character is not scanned.

Preconditions:
  • input != null
  • end <= input.length
  • offset < end
  • offset >= 0

Postconditions:
  • the state of the receiver is updated to reflect the XML elementparsed from the reader

throws:
  XMLParseException - If an error occured while parsing the string.



parseCharArray
public void parseCharArray(char[] input, int offset, int end, int startingLineNr) throws XMLParseException(Code)
Reads one XML element from a char array and parses it.
Parameters:
  input - The reader from which to retrieve the XML data.
Parameters:
  offset - The first character in string to scan.
Parameters:
  end - The character where to stop scanning.This character is not scanned.
Parameters:
  startingLineNr - The line number of the first line in the data.

Preconditions:
  • input != null
  • end <= input.length
  • offset < end
  • offset >= 0

Postconditions:
  • the state of the receiver is updated to reflect the XML elementparsed from the reader

throws:
  XMLParseException - If an error occured while parsing the string.



parseFromReader
public void parseFromReader(Reader reader) throws IOException, XMLParseException(Code)
Reads one XML element from a java.io.Reader and parses it.
Parameters:
  reader - The reader from which to retrieve the XML data.

Preconditions:
  • reader != null
  • reader is not closed

Postconditions:
  • the state of the receiver is updated to reflect the XML elementparsed from the reader
  • the reader points to the first character following the last'>' character of the XML element

throws:
  java.io.IOException - If an error occured while reading the input.
throws:
  XMLParseException - If an error occured while parsing the read data.



parseFromReader
public void parseFromReader(Reader reader, int startingLineNr) throws IOException, XMLParseException(Code)
Reads one XML element from a java.io.Reader and parses it.
Parameters:
  reader - The reader from which to retrieve the XML data.
Parameters:
  startingLineNr - The line number of the first line in the data.

Preconditions:
  • reader != null
  • reader is not closed

Postconditions:
  • the state of the receiver is updated to reflect the XML elementparsed from the reader
  • the reader points to the first character following the last'>' character of the XML element

throws:
  java.io.IOException - If an error occured while reading the input.
throws:
  XMLParseException - If an error occured while parsing the read data.



parseString
public void parseString(String string) throws XMLParseException(Code)
Reads one XML element from a String and parses it.
Parameters:
  string - The reader from which to retrieve the XML data.

Preconditions:
  • string != null
  • string.length() > 0

Postconditions:
  • the state of the receiver is updated to reflect the XML elementparsed from the reader

throws:
  XMLParseException - If an error occured while parsing the string.



parseString
public void parseString(String string, int offset) throws XMLParseException(Code)
Reads one XML element from a String and parses it.
Parameters:
  string - The reader from which to retrieve the XML data.
Parameters:
  offset - The first character in string to scan.

Preconditions:
  • string != null
  • offset < string.length()
  • offset >= 0

Postconditions:
  • the state of the receiver is updated to reflect the XML elementparsed from the reader

throws:
  XMLParseException - If an error occured while parsing the string.



parseString
public void parseString(String string, int offset, int end) throws XMLParseException(Code)
Reads one XML element from a String and parses it.
Parameters:
  string - The reader from which to retrieve the XML data.
Parameters:
  offset - The first character in string to scan.
Parameters:
  end - The character where to stop scanning.This character is not scanned.

Preconditions:
  • string != null
  • end <= string.length()
  • offset < end
  • offset >= 0

Postconditions:
  • the state of the receiver is updated to reflect the XML elementparsed from the reader

throws:
  XMLParseException - If an error occured while parsing the string.



parseString
public void parseString(String string, int offset, int end, int startingLineNr) throws XMLParseException(Code)
Reads one XML element from a String and parses it.
Parameters:
  string - The reader from which to retrieve the XML data.
Parameters:
  offset - The first character in string to scan.
Parameters:
  end - The character where to stop scanning.This character is not scanned.
Parameters:
  startingLineNr - The line number of the first line in the data.

Preconditions:
  • string != null
  • end <= string.length()
  • offset < end
  • offset >= 0

Postconditions:
  • the state of the receiver is updated to reflect the XML elementparsed from the reader

throws:
  XMLParseException - If an error occured while parsing the string.



readChar
protected char readChar() throws IOException(Code)
Reads a character from a reader.



removeAttribute
public void removeAttribute(String name)(Code)
Removes an attribute.
Parameters:
  name - The name of the attribute.

Preconditions:
  • name != null
  • name is a valid XML identifier

Postconditions:
  • enumerateAttributeNames()=> old.enumerateAttributeNames() - name
  • getAttribute(name) => null

See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.setDoubleAttribute(Stringdouble)
See Also:   setDoubleAttribute(String, double)
See Also:   XMLElement.setIntAttribute(Stringint)
See Also:   setIntAttribute(String, int)
See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.getAttribute(String)
See Also:   getAttribute(String)
See Also:   XMLElement.getAttribute(StringObject)
See Also:   getAttribute(String, Object)
See Also:   XMLElement.getAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getStringAttribute(String)
See Also:   getStringAttribute(String)
See Also:   XMLElement.getStringAttribute(StringString)
See Also:   getStringAttribute(String, String)
See Also:   XMLElement.getStringAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getStringAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getIntAttribute(String)
See Also:   getIntAttribute(String)
See Also:   XMLElement.getIntAttribute(Stringint)
See Also:   getIntAttribute(String, int)
See Also:   XMLElement.getIntAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getIntAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getDoubleAttribute(String)
See Also:   getDoubleAttribute(String)
See Also:   XMLElement.getDoubleAttribute(Stringdouble)
See Also:   getDoubleAttribute(String, double)
See Also:   XMLElement.getDoubleAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getDoubleAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getBooleanAttribute(StringStringStringboolean)
See Also:   getBooleanAttribute(String, String, String, boolean)



removeChild
public void removeChild(XMLElement child)(Code)
Removes a child element.
Parameters:
  child - The child element to remove.

Preconditions:
  • child != null
  • child is a child element of the receiver

Postconditions:
  • countChildren() => old.countChildren() - 1
  • iterateChildren() => old.iterateChildren() - child
  • getChildren() => old.iterateChildren() - child

See Also:   XMLElement.addChild(XMLElement)
See Also:   addChild(XMLElement)
See Also:   XMLElement.countChildren
See Also:   XMLElement.iterateChildren
See Also:   XMLElement.getChildren



removeChild
public void removeChild(String name)(Code)
Removes an attribute.
Parameters:
  name - The name of the attribute.XMLElement.removeAttribute(String)removeAttribute



removeProperty
public void removeProperty(String name)(Code)
Removes an attribute.
Parameters:
  name - The name of the attribute.XMLElement.removeAttribute(String)removeAttribute



resolveEntity
protected void resolveEntity(StringBuffer buf) throws IOException(Code)
Resolves an entity. The name of the entity is read from the reader. The value of the entity is appended to buf.
Parameters:
  buf - Where to put the entity value.

Preconditions:
  • The first & has already been read.
  • buf != null



scanElement
protected void scanElement(XMLElement elt) throws IOException(Code)
Scans an XML element.
Parameters:
  elt - The element that will contain the result.

Preconditions:
  • The first < has already been read.
  • elt != null



scanIdentifier
protected void scanIdentifier(StringBuffer result) throws IOException(Code)
Scans an identifier from the current reader. The scanned identifier is appended to result.
Parameters:
  result - The buffer in which the scanned identifier will be put.

Preconditions:
  • result != null
  • The next character read from the reader is a valid firstcharacter of an XML identifier.

Postconditions:
  • The next character read from the reader won't be an identifiercharacter.



scanPCData
protected void scanPCData(StringBuffer data) throws IOException(Code)
Scans a #PCDATA element. CDATA sections and entities are resolved. The next < char is skipped. The scanned data is appended to data.

Preconditions:
  • data != null



scanString
protected void scanString(StringBuffer string) throws IOException(Code)
This method scans a delimited string from the current reader. The scanned string without delimiters is appended to string.

Preconditions:
  • string != null
  • the next char read is the string delimiter



scanWhitespace
protected char scanWhitespace() throws IOException(Code)
This method scans an identifier from the current reader. the next character following the whitespace.



scanWhitespace
protected char scanWhitespace(StringBuffer result) throws IOException(Code)
This method scans an identifier from the current reader. The scanned whitespace is appended to result. the next character following the whitespace.

Preconditions:
  • result != null



setAttribute
public void setAttribute(String name, Object value)(Code)
Adds or modifies an attribute.
Parameters:
  name - The name of the attribute.
Parameters:
  value - The value of the attribute.

Preconditions:
  • name != null
  • name is a valid XML identifier
  • value != null

Postconditions:
  • enumerateAttributeNames()=> old.enumerateAttributeNames() + name
  • getAttribute(name) => value

See Also:   XMLElement.setDoubleAttribute(Stringdouble)
See Also:   setDoubleAttribute(String, double)
See Also:   XMLElement.setIntAttribute(Stringint)
See Also:   setIntAttribute(String, int)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getAttribute(String)
See Also:   getAttribute(String)
See Also:   XMLElement.getAttribute(StringObject)
See Also:   getAttribute(String, Object)
See Also:   XMLElement.getAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getAttribute(String, HashMap, String, boolean)
See Also:   XMLElement.getStringAttribute(String)
See Also:   getStringAttribute(String)
See Also:   XMLElement.getStringAttribute(StringString)
See Also:   getStringAttribute(String, String)
See Also:   XMLElement.getStringAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getStringAttribute(String, HashMap, String, boolean)



setContent
public void setContent(String content)(Code)
Changes the content string.
Parameters:
  content - The new content string.



setDoubleAttribute
public void setDoubleAttribute(String name, double value)(Code)
Adds or modifies an attribute.
Parameters:
  name - The name of the attribute.
Parameters:
  value - The value of the attribute.

Preconditions:
  • name != null
  • name is a valid XML identifier

Postconditions:
  • enumerateAttributeNames()=> old.enumerateAttributeNames() + name
  • getDoubleAttribute(name) => value

See Also:   XMLElement.setIntAttribute(Stringint)
See Also:   setIntAttribute(String, int)
See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getDoubleAttribute(String)
See Also:   getDoubleAttribute(String)
See Also:   XMLElement.getDoubleAttribute(Stringdouble)
See Also:   getDoubleAttribute(String, double)
See Also:   XMLElement.getDoubleAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getDoubleAttribute(String, HashMap, String, boolean)



setIntAttribute
public void setIntAttribute(String name, int value)(Code)
Adds or modifies an attribute.
Parameters:
  name - The name of the attribute.
Parameters:
  value - The value of the attribute.

Preconditions:
  • name != null
  • name is a valid XML identifier

Postconditions:
  • enumerateAttributeNames()=> old.enumerateAttributeNames() + name
  • getIntAttribute(name) => value

See Also:   XMLElement.setDoubleAttribute(Stringdouble)
See Also:   setDoubleAttribute(String, double)
See Also:   XMLElement.setAttribute(StringObject)
See Also:   setAttribute(String, Object)
See Also:   XMLElement.removeAttribute(String)
See Also:   removeAttribute(String)
See Also:   XMLElement.enumerateAttributeNames
See Also:   XMLElement.getIntAttribute(String)
See Also:   getIntAttribute(String)
See Also:   XMLElement.getIntAttribute(Stringint)
See Also:   getIntAttribute(String, int)
See Also:   XMLElement.getIntAttribute(Stringjava.util.HashMapStringboolean)
See Also:   getIntAttribute(String, HashMap, String, boolean)



setName
public void setName(String name)(Code)
Changes the name of the element.
Parameters:
  name - The new name.

Preconditions:
  • name != null
  • name is a valid XML identifier

See Also:   XMLElement.getName



setTagName
public void setTagName(String name)(Code)
Changes the name of the element.
Parameters:
  name - The new name.XMLElement.setName(String) setName



skipComment
protected void skipComment() throws IOException(Code)
Skips a comment.

Preconditions:
  • The first <!-- has already been read.



skipSpecialTag
protected void skipSpecialTag(int bracketLevel) throws IOException(Code)
Skips a special tag or comment.
Parameters:
  bracketLevel - The number of open square brackets ([) that havealready been read.

Preconditions:
  • The first <! has already been read.
  • bracketLevel >= 0



syntaxError
protected XMLParseException syntaxError(String context)(Code)
Creates a parse exception for when a syntax error occured.
Parameters:
  context - The context in which the error occured.

Preconditions:
  • context != null
  • context.length() > 0



toString
public String toString()(Code)
Writes the XML element to a string.
See Also:   XMLElement.write(java.io.Writer)
See Also:    write(Writer)



unexpectedEndOfData
protected XMLParseException unexpectedEndOfData()(Code)
Creates a parse exception for when the end of the data input has been reached.



unknownEntity
protected XMLParseException unknownEntity(String name)(Code)
Creates a parse exception for when an entity could not be resolved.
Parameters:
  name - The name of the entity.

Preconditions:
  • name != null
  • name.length() > 0



unreadChar
protected void unreadChar(char ch)(Code)
Pushes a character back to the read-back buffer.
Parameters:
  ch - The character to push back.

Preconditions:
  • The read-back buffer is empty.
  • ch != '\0'



write
public void write(Writer writer) throws IOException(Code)
Writes the XML element to a writer.
Parameters:
  writer - The writer to write the XML data to.

Preconditions:
  • writer != null
  • writer is not closed

throws:
  java.io.IOException - If the data could not be written to the writer.
See Also:   XMLElement.toString



writeEncoded
protected void writeEncoded(Writer writer, String str) throws IOException(Code)
Writes a string encoded to a writer.
Parameters:
  writer - The writer to write the XML data to.
Parameters:
  str - The string to write encoded.

Preconditions:
  • writer != null
  • writer is not closed
  • str != null



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.