| 
JHotDraw 7.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.n3.nanoxml.XMLElement
public class XMLElement
XMLElement is an XML element. The standard NanoXML builder generates a tree of such elements.
StdXMLBuilder, 
Serialized Form| Field Summary | |
|---|---|
static int | 
NO_LINE
No line number defined.  | 
| Constructor Summary | |
|---|---|
XMLElement()
Creates an empty element to be used for #PCDATA content.  | 
|
XMLElement(java.lang.String fullName)
Creates an empty element.  | 
|
XMLElement(java.lang.String fullName,
           java.lang.String namespace)
Creates an empty element.  | 
|
XMLElement(java.lang.String fullName,
           java.lang.String systemID,
           int lineNr)
Creates an empty element.  | 
|
XMLElement(java.lang.String fullName,
           java.lang.String namespace,
           java.lang.String systemID,
           int lineNr)
Creates an empty element.  | 
|
| Method Summary | |
|---|---|
 void | 
addChild(IXMLElement child)
Adds a child element.  | 
 IXMLElement | 
createElement(java.lang.String fullName)
Creates an empty element.  | 
 IXMLElement | 
createElement(java.lang.String fullName,
              java.lang.String namespace)
Creates an empty element.  | 
 IXMLElement | 
createElement(java.lang.String fullName,
              java.lang.String systemID,
              int lineNr)
Creates an empty element.  | 
 IXMLElement | 
createElement(java.lang.String fullName,
              java.lang.String namespace,
              java.lang.String systemID,
              int lineNr)
Creates an empty element.  | 
 IXMLElement | 
createPCDataElement()
Creates an element to be used for #PCDATA content.  | 
 boolean | 
equals(java.lang.Object rawElement)
Returns true if the element equals another element.  | 
 boolean | 
equalsXMLElement(IXMLElement elt)
Returns true if the element equals another element.  | 
protected  void | 
finalize()
Cleans up the object when it's destroyed.  | 
 java.lang.String | 
getAttribute(java.lang.String name)
Deprecated. As of NanoXML/Java 2.1, replaced by getAttribute(java.lang.String,java.lang.String)
 Returns the value of an attribute. | 
 int | 
getAttribute(java.lang.String name,
             int defaultValue)
Returns the value of an attribute.  | 
 java.lang.String | 
getAttribute(java.lang.String name,
             java.lang.String defaultValue)
Returns the value of an attribute.  | 
 int | 
getAttribute(java.lang.String name,
             java.lang.String namespace,
             int defaultValue)
Returns the value of an attribute.  | 
 java.lang.Object | 
getAttribute(java.lang.String name,
             java.lang.String namespace,
             java.util.Map valueSet,
             java.lang.String defaultKey)
Returns an attribute by looking up a key in a hashtable.  | 
 java.lang.String | 
getAttribute(java.lang.String name,
             java.lang.String namespace,
             java.lang.String defaultValue)
Returns the value of an attribute.  | 
 int | 
getAttributeCount()
Returns the number of attributes.  | 
 java.lang.String | 
getAttributeNamespace(java.lang.String name)
Returns the namespace of an attribute.  | 
 java.util.Properties | 
getAttributes()
Returns all attributes as a Properties object.  | 
 java.util.Properties | 
getAttributesInNamespace(java.lang.String namespace)
Returns all attributes in a specific namespace as a Properties object.  | 
 java.lang.String | 
getAttributeType(java.lang.String name)
Returns the type of an attribute.  | 
 java.lang.String | 
getAttributeType(java.lang.String name,
                 java.lang.String namespace)
Returns the type of an attribute.  | 
 IXMLElement | 
getChildAtIndex(int index)
Returns the child at a specific index.  | 
 java.util.ArrayList | 
getChildren()
Returns a vector containing all the child iterator.  | 
 int | 
getChildrenCount()
Returns the number of children.  | 
 java.util.ArrayList | 
getChildrenNamed(java.lang.String name)
Returns a vector of all child iterator named name.  | 
 java.util.ArrayList | 
getChildrenNamed(java.lang.String name,
                 java.lang.String namespace)
Returns a vector of all child iterator named name.  | 
 java.lang.String | 
getContent()
Return the #PCDATA content of the element.  | 
 double | 
getDoubleAttribute(java.lang.String name,
                   java.lang.String namespace,
                   double defaultValue)
Returns an attribute of the element.  | 
 IXMLElement | 
getFirstChildNamed(java.lang.String name)
Searches a child element.  | 
 IXMLElement | 
getFirstChildNamed(java.lang.String name,
                   java.lang.String namespace)
Searches a child element.  | 
 java.lang.String | 
getFullName()
Returns the full name (i.e.  | 
 int | 
getLineNr()
Returns the line number in the data where the element started.  | 
 java.lang.String | 
getName()
Returns the name of the element.  | 
 java.lang.String | 
getNamespace()
Returns the namespace of the element.  | 
 IXMLElement | 
getParent()
Returns the parent element.  | 
 java.lang.String | 
getSystemID()
Returns the system ID of the data where the element started.  | 
 boolean | 
hasAttribute(java.lang.String name)
Returns whether an attribute exists.  | 
 boolean | 
hasAttribute(java.lang.String name,
             java.lang.String namespace)
Returns whether an attribute exists.  | 
 boolean | 
hasChildren()
Returns whether the element has children.  | 
 void | 
insertChild(IXMLElement child,
            int index)
Inserts a child element.  | 
 boolean | 
isLeaf()
Returns whether the element is a leaf element.  | 
 java.util.Iterator | 
iterateAttributeNames()
Returns an enumeration of all attribute names.  | 
 java.util.Iterator | 
iterateChildren()
Returns an enumeration of all child iterator.  | 
 void | 
removeAttribute(java.lang.String name)
Removes an attribute.  | 
 void | 
removeAttribute(java.lang.String name,
                java.lang.String namespace)
Removes an attribute.  | 
 void | 
removeChild(IXMLElement child)
Removes a child element.  | 
 void | 
removeChildAtIndex(int index)
Removes the child located at a certain index.  | 
 void | 
setAttribute(java.lang.String name,
             java.lang.String value)
Sets an attribute.  | 
 void | 
setAttribute(java.lang.String fullName,
             java.lang.String namespace,
             java.lang.String value)
Sets an attribute.  | 
 void | 
setContent(java.lang.String content)
Sets the #PCDATA content.  | 
 void | 
setName(java.lang.String name)
Sets the full name.  | 
 void | 
setName(java.lang.String fullName,
        java.lang.String namespace)
Sets the name.  | 
 java.lang.String | 
toString()
 | 
| Methods inherited from class java.lang.Object | 
|---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final int NO_LINE
| Constructor Detail | 
|---|
public XMLElement()
public XMLElement(java.lang.String fullName)
fullName - the name of the element.
public XMLElement(java.lang.String fullName,
                  java.lang.String systemID,
                  int lineNr)
fullName - the name of the element.systemID - the system ID of the XML data where the element starts.lineNr - the line in the XML data where the element starts.
public XMLElement(java.lang.String fullName,
                  java.lang.String namespace)
fullName - the full name of the elementnamespace - the namespace URI.
public XMLElement(java.lang.String fullName,
                  java.lang.String namespace,
                  java.lang.String systemID,
                  int lineNr)
fullName - the full name of the elementnamespace - the namespace URI.systemID - the system ID of the XML data where the element starts.lineNr - the line in the XML data where the element starts.| Method Detail | 
|---|
public IXMLElement createPCDataElement()
createPCDataElement in interface IXMLElementpublic IXMLElement createElement(java.lang.String fullName)
createElement in interface IXMLElementfullName - the name of the element.
public IXMLElement createElement(java.lang.String fullName,
                                 java.lang.String systemID,
                                 int lineNr)
createElement in interface IXMLElementfullName - the name of the element.systemID - the system ID of the XML data where the element starts.lineNr - the line in the XML data where the element starts.
public IXMLElement createElement(java.lang.String fullName,
                                 java.lang.String namespace)
createElement in interface IXMLElementfullName - the full name of the elementnamespace - the namespace URI.
public IXMLElement createElement(java.lang.String fullName,
                                 java.lang.String namespace,
                                 java.lang.String systemID,
                                 int lineNr)
createElement in interface IXMLElementfullName - the full name of the elementnamespace - the namespace URI.systemID - the system ID of the XML data where the element starts.lineNr - the line in the XML data where the element starts.
protected void finalize()
                 throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic IXMLElement getParent()
getParent in interface IXMLElementpublic java.lang.String getFullName()
getFullName in interface IXMLElementpublic java.lang.String getName()
getName in interface IXMLElementpublic java.lang.String getNamespace()
getNamespace in interface IXMLElementpublic void setName(java.lang.String name)
setName in interface IXMLElementname - the non-null name.
public void setName(java.lang.String fullName,
                    java.lang.String namespace)
setName in interface IXMLElementfullName - the non-null full name.namespace - the namespace URI, which may be null.public void addChild(IXMLElement child)
addChild in interface IXMLElementchild - the non-null child to add.
public void insertChild(IXMLElement child,
                        int index)
child - the non-null child to add.index - where to put the child.public void removeChild(IXMLElement child)
removeChild in interface IXMLElementchild - the non-null child to remove.public void removeChildAtIndex(int index)
removeChildAtIndex in interface IXMLElementindex - the index of the child, where the first child has index 0.public java.util.Iterator iterateChildren()
iterateChildren in interface IXMLElementpublic boolean isLeaf()
isLeaf in interface IXMLElementpublic boolean hasChildren()
hasChildren in interface IXMLElementpublic int getChildrenCount()
getChildrenCount in interface IXMLElementpublic java.util.ArrayList getChildren()
getChildren in interface IXMLElement
public IXMLElement getChildAtIndex(int index)
                            throws java.lang.ArrayIndexOutOfBoundsException
getChildAtIndex in interface IXMLElementindex - the index of the child
java.lang.ArrayIndexOutOfBoundsException - if the index is out of bounds.public IXMLElement getFirstChildNamed(java.lang.String name)
getFirstChildNamed in interface IXMLElementname - the full name of the child to search for.
public IXMLElement getFirstChildNamed(java.lang.String name,
                                      java.lang.String namespace)
getFirstChildNamed in interface IXMLElementname - the name of the child to search for.namespace - the namespace, which may be null.
public java.util.ArrayList getChildrenNamed(java.lang.String name)
getChildrenNamed in interface IXMLElementname - the full name of the children to search for.
public java.util.ArrayList getChildrenNamed(java.lang.String name,
                                            java.lang.String namespace)
getChildrenNamed in interface IXMLElementname - the name of the children to search for.namespace - the namespace, which may be null.
public int getAttributeCount()
getAttributeCount in interface IXMLElementpublic java.lang.String getAttribute(java.lang.String name)
getAttribute(java.lang.String,java.lang.String)
 Returns the value of an attribute.
getAttribute in interface IXMLElementname - the non-null name of the attribute.
public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String defaultValue)
getAttribute in interface IXMLElementname - the non-null full name of the attribute.defaultValue - the default value of the attribute.
public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String namespace,
                                     java.lang.String defaultValue)
getAttribute in interface IXMLElementname - the non-null name of the attribute.namespace - the namespace URI, which may be null.defaultValue - the default value of the attribute.
public double getDoubleAttribute(java.lang.String name,
                                 java.lang.String namespace,
                                 double defaultValue)
defaultValue is returned.
getDoubleAttribute in interface IXMLElementname - The name of the attribute.namespace - the namespace URI, which may be null.defaultValue - Key to use if the attribute is missing.
public int getAttribute(java.lang.String name,
                        int defaultValue)
getAttribute in interface IXMLElementname - the non-null full name of the attribute.defaultValue - the default value of the attribute.
public int getAttribute(java.lang.String name,
                        java.lang.String namespace,
                        int defaultValue)
getAttribute in interface IXMLElementname - the non-null name of the attribute.namespace - the namespace URI, which may be null.defaultValue - the default value of the attribute.
public java.lang.Object getAttribute(java.lang.String name,
                                     java.lang.String namespace,
                                     java.util.Map valueSet,
                                     java.lang.String defaultKey)
 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".
getAttribute in interface IXMLElementname - The name of the attribute.namespace - the namespace URI, which may be null.valueSet - HashMap mapping keySet().iterator to values.defaultKey - Key to use if the attribute is missing.
 name != null
     name is a valid XML identifier
     valueSet != null
     valueSet are strings
 public java.lang.String getAttributeType(java.lang.String name)
getAttributeType in interface IXMLElementname - the non-null full name of the attribute.
public java.lang.String getAttributeNamespace(java.lang.String name)
getAttributeNamespace in interface IXMLElementname - the non-null full name of the attribute.
public java.lang.String getAttributeType(java.lang.String name,
                                         java.lang.String namespace)
getAttributeType in interface IXMLElementname - the non-null name of the attribute.namespace - the namespace URI, which may be null.
public void setAttribute(java.lang.String name,
                         java.lang.String value)
setAttribute in interface IXMLElementname - the non-null full name of the attribute.value - the non-null value of the attribute.
public void setAttribute(java.lang.String fullName,
                         java.lang.String namespace,
                         java.lang.String value)
setAttribute in interface IXMLElementfullName - the non-null full name of the attribute.namespace - the namespace URI of the attribute, which may be null.value - the non-null value of the attribute.public void removeAttribute(java.lang.String name)
removeAttribute in interface IXMLElementname - the non-null name of the attribute.
public void removeAttribute(java.lang.String name,
                            java.lang.String namespace)
removeAttribute in interface IXMLElementname - the non-null name of the attribute.namespace - the namespace URI of the attribute, which may be null.public java.util.Iterator iterateAttributeNames()
iterateAttributeNames in interface IXMLElementpublic boolean hasAttribute(java.lang.String name)
hasAttribute in interface IXMLElementname - the non-null name of the attribute.
public boolean hasAttribute(java.lang.String name,
                            java.lang.String namespace)
hasAttribute in interface IXMLElementname - the non-null name of the attribute.namespace - the namespace URI of the attribute, which may be null.
public java.util.Properties getAttributes()
getAttributes in interface IXMLElementpublic java.util.Properties getAttributesInNamespace(java.lang.String namespace)
getAttributesInNamespace in interface IXMLElementnamespace - the namespace URI of the attributes, which may be null.
public java.lang.String getSystemID()
getSystemID in interface IXMLElementgetLineNr()public int getLineNr()
getLineNr in interface IXMLElementNO_LINE, 
getSystemID()public java.lang.String getContent()
getContent in interface IXMLElementpublic void setContent(java.lang.String content)
setContent in interface IXMLElementcontent - the (possibly null) content.public boolean equals(java.lang.Object rawElement)
equals in interface IXMLElementequals in class java.lang.ObjectrawElement - the element to compare topublic boolean equalsXMLElement(IXMLElement elt)
equalsXMLElement in interface IXMLElementelt - the element to compare topublic java.lang.String toString()
toString in class java.lang.Object
  | 
Copyright 1996-2007 (c) JHotDraw.org. Some rights reserved.  | 
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||