Java Doc for Element.java in  » Workflow-Engines » OpenWFE » org » jdom » 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 » Workflow Engines » OpenWFE » org.jdom 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jdom.Content
      org.jdom.Element

Element
public class Element extends Content implements Parent(Code)
An XML element. Methods allow the user to get and manipulate its child elements and content, directly access the element's textual content, manipulate its attributes, and manage namespaces.
version:
   $Revision: 1.2 $, $Date: 2005/05/03 07:02:04 $
author:
   Brett McLaughlin
author:
   Jason Hunter
author:
   Lucas Gonze
author:
   Kevin Regan
author:
   Dan Schaffer
author:
   Yusuf Goolamabbas
author:
   Kent C. Johnson
author:
   Jools Enticknap
author:
   Alex Rosen
author:
   Bradley S. Huffman


Field Summary
protected transient  ListadditionalNamespaces
    
 AttributeListattributes
     The attributes of the element.
 ContentListcontent
     The content of the element.
protected  Stringname
    
protected transient  Namespacenamespace
    

Constructor Summary
protected  Element()
     This protected constructor is provided in order to support an Element subclass that wants full control over variable initialization.
public  Element(String name, Namespace namespace)
     Creates a new element with the supplied (local) name and namespace.
public  Element(String name)
     Create a new element with the supplied (local) name and no namespace.
public  Element(String name, String uri)
     Creates a new element with the supplied (local) name and a namespace given by a URI.
public  Element(String name, String prefix, String uri)
     Creates a new element with the supplied (local) name and a namespace given by the supplied prefix and URI combination.

Method Summary
public  ElementaddContent(String str)
     This adds text content to this element.
public  ElementaddContent(Content child)
     Appends the child to the end of the element's content list.
Parameters:
  child - child to append to end of content list the element on which the method was called
throws:
  IllegalAddException - if the given child already has a parent.
public  ElementaddContent(Collection collection)
     Appends all children in the given collection to the end of the content list.
public  ElementaddContent(int index, Content child)
     Inserts the child into the content list at the given index.
public  ElementaddContent(int index, Collection c)
     Inserts the content in a collection into the content list at the given index.
public  voidaddNamespaceDeclaration(Namespace additional)
     Adds a namespace declarations to this element.
public  Objectclone()
    

This returns a deep clone of this element.

public  ListcloneContent()
    
public  ListgetAdditionalNamespaces()
     Returns a list of the additional namespace declarations on this element. This includes only additional namespace, not the namespace of the element itself, which can be obtained through Element.getNamespace() .
public  AttributegetAttribute(String name)
    

This returns the attribute for this element with the given name and within no namespace, or null if no such attribute exists.

public  AttributegetAttribute(String name, Namespace ns)
    

This returns the attribute for this element with the given name and within the given Namespace, or null if no such attribute exists.

public  StringgetAttributeValue(String name)
    

This returns the attribute value for the attribute with the given name and within no namespace, null if there is no such attribute, and the empty string if the attribute value is empty.

public  StringgetAttributeValue(String name, String def)
    

This returns the attribute value for the attribute with the given name and within no namespace, or the passed-in default if there is no such attribute.

public  StringgetAttributeValue(String name, Namespace ns)
    

This returns the attribute value for the attribute with the given name and within the given Namespace, null if there is no such attribute, and the empty string if the attribute value is empty.

public  StringgetAttributeValue(String name, Namespace ns, String def)
    

This returns the attribute value for the attribute with the given name and within the given Namespace, or the passed-in default if there is no such attribute.

public  ListgetAttributes()
    

This returns the complete set of attributes for this element, as a List of Attribute objects in no particular order, or an empty list if there are none.

public  ElementgetChild(String name, Namespace ns)
     This returns the first child element within this element with the given local name and belonging to the given namespace.
public  ElementgetChild(String name)
     This returns the first child element within this element with the given local name and belonging to no namespace.
public  StringgetChildText(String name)
     Returns the textual content of the named child element, or null if there's no such child.
public  StringgetChildText(String name, Namespace ns)
     Returns the textual content of the named child element, or null if there's no such child.
public  StringgetChildTextNormalize(String name)
     Returns the normalized textual content of the named child element, or null if there's no such child.
public  StringgetChildTextNormalize(String name, Namespace ns)
     Returns the normalized textual content of the named child element, or null if there's no such child.
public  StringgetChildTextTrim(String name)
     Returns the trimmed textual content of the named child element, or null if there's no such child.
public  StringgetChildTextTrim(String name, Namespace ns)
     Returns the trimmed textual content of the named child element, or null if there's no such child.
public  ListgetChildren()
     This returns a List of all the child elements nested directly (one level deep) within this element, as Element objects.
public  ListgetChildren(String name)
     This returns a List of all the child elements nested directly (one level deep) within this element with the given local name and belonging to no namespace, returned as Element objects.
public  ListgetChildren(String name, Namespace ns)
     This returns a List of all the child elements nested directly (one level deep) within this element with the given local name and belonging to the given Namespace, returned as Element objects.
public  ListgetContent()
     This returns the full content of the element as a List which may contain objects of type Text, Element, Comment, ProcessingInstruction, CDATA, and EntityRef. The List returned is "live" in document order and modifications to it affect the element's actual contents.
public  ListgetContent(Filter filter)
     Return a filter view of this Element's content.
public  ContentgetContent(int index)
    
public  intgetContentSize()
    
public  IteratorgetDescendants()
     Returns an iterator that walks over all descendants in document order.
public  IteratorgetDescendants(Filter filter)
     Returns an iterator that walks over all descendants in document order applying the Filter to return only elements that match the filter rule.
public  StringgetName()
     Returns the (local) name of the element (without any namespace prefix).
public  NamespacegetNamespace()
     Returns the element's Namespace .
public  NamespacegetNamespace(String prefix)
     Returns the Namespace corresponding to the given prefix in scope for this element.
public  StringgetNamespacePrefix()
     Returns the namespace prefix of the element or an empty string if none exists.
public  StringgetNamespaceURI()
     Returns the namespace URI mapped to this element's prefix (or the in-scope default namespace URI if no prefix).
public  StringgetQualifiedName()
     Returns the full name of the element, in the form [namespacePrefix]:[localName].
public  StringgetText()
     Returns the textual content directly held under this element as a string. This includes all text within this single element, including whitespace and CDATA sections if they exist.
public  StringgetTextNormalize()
     Returns the textual content of this element with all surrounding whitespace removed and internal whitespace normalized to a single space.
public  StringgetTextTrim()
     Returns the textual content of this element with all surrounding whitespace removed.
public  StringgetValue()
    
public  intindexOf(Content child)
    
public  booleanisAncestor(Element element)
     Determines if this element is the ancestor of another element.
public  booleanisRootElement()
     Returns whether this element is a root element.
public  booleanremoveAttribute(String name)
    

This removes the attribute with the given name and within no namespace.

public  booleanremoveAttribute(String name, Namespace ns)
    

This removes the attribute with the given name and within the given Namespace.

public  booleanremoveAttribute(Attribute attribute)
    

This removes the supplied Attribute should it exist.


Parameters:
  attribute - Reference to the attribute to be removed.
public  booleanremoveChild(String name)
    

This removes the first child element (one level deep) with the given local name and belonging to no namespace.

public  booleanremoveChild(String name, Namespace ns)
    

This removes the first child element (one level deep) with the given local name and belonging to the given namespace.

public  booleanremoveChildren(String name)
    

This removes all child elements (one level deep) with the given local name and belonging to no namespace.

public  booleanremoveChildren(String name, Namespace ns)
    

This removes all child elements (one level deep) with the given local name and belonging to the given namespace.

public  ListremoveContent()
     Removes all child content from this parent.
public  ListremoveContent(Filter filter)
     Remove all child content from this parent matching the supplied filter.
public  booleanremoveContent(Content child)
    
public  ContentremoveContent(int index)
    
public  voidremoveNamespaceDeclaration(Namespace additionalNamespace)
     Removes an additional namespace declarations from this element.
public  ElementsetAttribute(String name, String value)
    

This sets an attribute value for this element.

public  ElementsetAttribute(String name, String value, Namespace ns)
    

This sets an attribute value for this element.

public  ElementsetAttribute(Attribute attribute)
    

This sets an attribute value for this element.

public  ElementsetAttributes(List newAttributes)
    

This sets the attributes of the element.

public  ElementsetContent(Collection newContent)
     This sets the content of the element.
public  ElementsetContent(int index, Content child)
     Replace the current child the given index with the supplied child.

In event of an exception the original content will be unchanged and the supplied child will be unaltered.


Parameters:
  index - - index of child to replace.
Parameters:
  child - - child to add.
public  ParentsetContent(int index, Collection collection)
     Replace the child at the given index whith the supplied collection.

In event of an exception the original content will be unchanged and the content in the supplied collection will be unaltered.


Parameters:
  index - - index of child to replace.
Parameters:
  collection - - collection of content to add.
public  ElementsetContent(Content child)
     Set this element's content to be the supplied child.

If the supplied child is legal content for this parent and before it is added, all content in the current content list will be cleared and all current children will have their parentage set to null.

This has the effect that any active list (previously obtained with a call to one of the Element.getContent methods will also change to reflect the new content.

public  ElementsetName(String name)
     Sets the (local) name of the element.
public  ElementsetNamespace(Namespace namespace)
     Sets the element's Namespace .
public  ElementsetText(String text)
     Sets the content of the element to be the text given.
public  StringtoString()
    

This returns a String representation of the Element, suitable for debugging.


Field Detail
additionalNamespaces
protected transient List additionalNamespaces(Code)
Additional namespace declarations to store on this element; useful during output



attributes
AttributeList attributes(Code)
The attributes of the element. Subclassers have to track attributes using their own mechanism.



content
ContentList content(Code)
The content of the element. Subclassers have to track content using their own mechanism.



name
protected String name(Code)
The local name of the element



namespace
protected transient Namespace namespace(Code)
The namespace of the element




Constructor Detail
Element
protected Element()(Code)
This protected constructor is provided in order to support an Element subclass that wants full control over variable initialization. It intentionally leaves all instance variables null, allowing a lightweight subclass implementation. The subclass is responsible for ensuring all the get and set methods on Element behave as documented.

When implementing an Element subclass which doesn't require full control over variable initialization, be aware that simply calling super() (or letting the compiler add the implicit super() call) will not initialize the instance variables which will cause many of the methods to throw a NullPointerException. Therefore, the constructor for these subclasses should call one of the public constructors so variable initialization is handled automatically.




Element
public Element(String name, Namespace namespace)(Code)
Creates a new element with the supplied (local) name and namespace. If the provided namespace is null, the element will have no namespace.
Parameters:
  name - local name of the element
Parameters:
  namespace - namespace for the element
throws:
  IllegalNameException - if the given name is illegal as an elementname



Element
public Element(String name)(Code)
Create a new element with the supplied (local) name and no namespace.
Parameters:
  name - local name of the element
throws:
  IllegalNameException - if the given name is illegal as an elementname.



Element
public Element(String name, String uri)(Code)
Creates a new element with the supplied (local) name and a namespace given by a URI. The element will be put into the unprefixed (default) namespace.
Parameters:
  name - name of the element
Parameters:
  uri - namespace URI for the element
throws:
  IllegalNameException - if the given name is illegal as an elementname or the given URI is illegal as anamespace URI



Element
public Element(String name, String prefix, String uri)(Code)
Creates a new element with the supplied (local) name and a namespace given by the supplied prefix and URI combination.
Parameters:
  name - local name of the element
Parameters:
  prefix - namespace prefix
Parameters:
  uri - namespace URI for the element
throws:
  IllegalNameException - if the given name is illegal as an elementname, the given prefix is illegal as anamespace prefix, or the given URI isillegal as a namespace URI




Method Detail
addContent
public Element addContent(String str)(Code)
This adds text content to this element. It does not replace the existing content as does setText().
Parameters:
  str - String to add this element modified
throws:
  IllegalDataException - if str contains anillegal character such as a vertical tab (as determinedby org.jdom.Verifier.checkCharacterData)



addContent
public Element addContent(Content child)(Code)
Appends the child to the end of the element's content list.
Parameters:
  child - child to append to end of content list the element on which the method was called
throws:
  IllegalAddException - if the given child already has a parent.



addContent
public Element addContent(Collection collection)(Code)
Appends all children in the given collection to the end of the content list. In event of an exception during add the original content will be unchanged and the objects in the supplied collection will be unaltered.
Parameters:
  collection - collection to append the element on which the method was called
throws:
  IllegalAddException - if any item in the collectionalready has a parent or is of an inappropriate type.



addContent
public Element addContent(int index, Content child)(Code)
Inserts the child into the content list at the given index.
Parameters:
  index - location for adding the collection
Parameters:
  child - child to insert the parent on which the method was called
throws:
  IndexOutOfBoundsException - if index is negative or beyondthe current number of children
throws:
  IllegalAddException - if the given child already has a parent.



addContent
public Element addContent(int index, Collection c)(Code)
Inserts the content in a collection into the content list at the given index. In event of an exception the original content will be unchanged and the objects in the supplied collection will be unaltered.
Parameters:
  index - location for adding the collection
Parameters:
  c - collection to insert the parent on which the method was called
throws:
  IndexOutOfBoundsException - if index is negative or beyondthe current number of children
throws:
  IllegalAddException - if any item in the collectionalready has a parent or is of an inappropriate type.



addNamespaceDeclaration
public void addNamespaceDeclaration(Namespace additional)(Code)
Adds a namespace declarations to this element. This should not be used to add the declaration for this element itself; that should be assigned in the construction of the element. Instead, this is for adding namespace declarations on the element not relating directly to itself. It's used during output to for stylistic reasons move namespace declarations higher in the tree than they would have to be.
Parameters:
  additional - namespace to add
throws:
  IllegalAddException - if the namespace prefix collides with anothernamespace prefix on the element



clone
public Object clone()(Code)

This returns a deep clone of this element. The new element is detached from its parent, and getParent() on the clone will return null.

the clone of this element



cloneContent
public List cloneContent()(Code)



getAdditionalNamespaces
public List getAdditionalNamespaces()(Code)
Returns a list of the additional namespace declarations on this element. This includes only additional namespace, not the namespace of the element itself, which can be obtained through Element.getNamespace() . If there are no additional declarations, this returns an empty list. Note, the returned list is unmodifiable. a List of the additional namespacedeclarations



getAttribute
public Attribute getAttribute(String name)(Code)

This returns the attribute for this element with the given name and within no namespace, or null if no such attribute exists.


Parameters:
  name - name of the attribute to return attribute for the element



getAttribute
public Attribute getAttribute(String name, Namespace ns)(Code)

This returns the attribute for this element with the given name and within the given Namespace, or null if no such attribute exists.


Parameters:
  name - name of the attribute to return
Parameters:
  ns - Namespace to search within attribute for the element



getAttributeValue
public String getAttributeValue(String name)(Code)

This returns the attribute value for the attribute with the given name and within no namespace, null if there is no such attribute, and the empty string if the attribute value is empty.


Parameters:
  name - name of the attribute whose value to be returned the named attribute's value, or null if no such attribute



getAttributeValue
public String getAttributeValue(String name, String def)(Code)

This returns the attribute value for the attribute with the given name and within no namespace, or the passed-in default if there is no such attribute.


Parameters:
  name - name of the attribute whose value to be returned
Parameters:
  def - a default value to return if the attribute does not exist the named attribute's value, or the default if no such attribute



getAttributeValue
public String getAttributeValue(String name, Namespace ns)(Code)

This returns the attribute value for the attribute with the given name and within the given Namespace, null if there is no such attribute, and the empty string if the attribute value is empty.


Parameters:
  name - name of the attribute whose valud is to be returned
Parameters:
  ns - Namespace to search within the named attribute's value, or null if no such attribute



getAttributeValue
public String getAttributeValue(String name, Namespace ns, String def)(Code)

This returns the attribute value for the attribute with the given name and within the given Namespace, or the passed-in default if there is no such attribute.


Parameters:
  name - name of the attribute whose valud is to be returned
Parameters:
  ns - Namespace to search within
Parameters:
  def - a default value to return if the attribute does not exist the named attribute's value, or the default if no such attribute



getAttributes
public List getAttributes()(Code)

This returns the complete set of attributes for this element, as a List of Attribute objects in no particular order, or an empty list if there are none. The returned list is "live" and changes to it affect the element's actual attributes.

attributes for the element



getChild
public Element getChild(String name, Namespace ns)(Code)
This returns the first child element within this element with the given local name and belonging to the given namespace. If no elements exist for the specified name and namespace, null is returned.
Parameters:
  name - local name of child element to match
Parameters:
  ns - Namespace to search within the first matching child element, or null if not found



getChild
public Element getChild(String name)(Code)
This returns the first child element within this element with the given local name and belonging to no namespace. If no elements exist for the specified name and namespace, null is returned.
Parameters:
  name - local name of child element to match the first matching child element, or null if not found



getChildText
public String getChildText(String name)(Code)
Returns the textual content of the named child element, or null if there's no such child. This method is a convenience because calling getChild().getText() can throw a NullPointerException.
Parameters:
  name - the name of the child text content for the named child, or null ifno such child



getChildText
public String getChildText(String name, Namespace ns)(Code)
Returns the textual content of the named child element, or null if there's no such child.
Parameters:
  name - the name of the child
Parameters:
  ns - the namespace of the child text content for the named child, or null ifno such child



getChildTextNormalize
public String getChildTextNormalize(String name)(Code)
Returns the normalized textual content of the named child element, or null if there's no such child. See Element.getTextNormalize() for details of text normalizing.
Parameters:
  name - the name of the child normalized text content for the named child,or null if no such child



getChildTextNormalize
public String getChildTextNormalize(String name, Namespace ns)(Code)
Returns the normalized textual content of the named child element, or null if there's no such child.
Parameters:
  name - the name of the child
Parameters:
  ns - the namespace of the child normalized text content for the named child,or null if no such child



getChildTextTrim
public String getChildTextTrim(String name)(Code)
Returns the trimmed textual content of the named child element, or null if there's no such child. See Element.getTextTrim() for details of text trimming.
Parameters:
  name - the name of the child trimmed text content for the named child, ornull if no such child



getChildTextTrim
public String getChildTextTrim(String name, Namespace ns)(Code)
Returns the trimmed textual content of the named child element, or null if there's no such child.
Parameters:
  name - the name of the child
Parameters:
  ns - the namespace of the child trimmed text content for the named child, ornull if no such child



getChildren
public List getChildren()(Code)
This returns a List of all the child elements nested directly (one level deep) within this element, as Element objects. If this target element has no nested elements, an empty List is returned. The returned list is "live" in document order and changes to it affect the element's actual contents.

Sequential traversal through the List is best done with a Iterator since the underlying implement of List.size() may not be the most efficient.

No recursion is performed, so elements nested two levels deep would have to be obtained with:

 
 Iterator itr = (currentElement.getChildren()).iterator();
 while(itr.hasNext()) {
 Element oneLevelDeep = (Element)itr.next();
 List twoLevelsDeep = oneLevelDeep.getChildren();
 // Do something with these children
 }
 
 

list of child Element objects for this element



getChildren
public List getChildren(String name)(Code)
This returns a List of all the child elements nested directly (one level deep) within this element with the given local name and belonging to no namespace, returned as Element objects. If this target element has no nested elements with the given name outside a namespace, an empty List is returned. The returned list is "live" in document order and changes to it affect the element's actual contents.

Please see the notes for Element.getChildren for a code example.


Parameters:
  name - local name for the children to match all matching child elements



getChildren
public List getChildren(String name, Namespace ns)(Code)
This returns a List of all the child elements nested directly (one level deep) within this element with the given local name and belonging to the given Namespace, returned as Element objects. If this target element has no nested elements with the given name in the given Namespace, an empty List is returned. The returned list is "live" in document order and changes to it affect the element's actual contents.

Please see the notes for Element.getChildren for a code example.


Parameters:
  name - local name for the children to match
Parameters:
  ns - Namespace to search within all matching child elements



getContent
public List getContent()(Code)
This returns the full content of the element as a List which may contain objects of type Text, Element, Comment, ProcessingInstruction, CDATA, and EntityRef. The List returned is "live" in document order and modifications to it affect the element's actual contents. Whitespace content is returned in its entirety.

Sequential traversal through the List is best done with an Iterator since the underlying implement of List.size() may require walking the entire list.

a List containing the mixed content of theelement: may contain Text,Element, Comment,ProcessingInstruction,CDATA, andEntityRef objects.



getContent
public List getContent(Filter filter)(Code)
Return a filter view of this Element's content.

Sequential traversal through the List is best done with a Iterator since the underlying implement of List.size() may require walking the entire list.


Parameters:
  filter - Filter to apply List - filtered Element content



getContent
public Content getContent(int index)(Code)



getContentSize
public int getContentSize()(Code)



getDescendants
public Iterator getDescendants()(Code)
Returns an iterator that walks over all descendants in document order. an iterator to walk descendants



getDescendants
public Iterator getDescendants(Filter filter)(Code)
Returns an iterator that walks over all descendants in document order applying the Filter to return only elements that match the filter rule. With filters you can match only Elements, only Comments, Elements or Comments, only Elements with a given name and/or prefix, and so on.
Parameters:
  filter - filter to select which descendants to see an iterator to walk descendants within a filter



getName
public String getName()(Code)
Returns the (local) name of the element (without any namespace prefix). local element name



getNamespace
public Namespace getNamespace()(Code)
Returns the element's Namespace . the element's namespace



getNamespace
public Namespace getNamespace(String prefix)(Code)
Returns the Namespace corresponding to the given prefix in scope for this element. This involves searching up the tree, so the results depend on the current location of the element. Returns null if there is no namespace in scope with the given prefix at this point in the document.
Parameters:
  prefix - namespace prefix to look up the Namespace for this prefix at thislocation, or null if none



getNamespacePrefix
public String getNamespacePrefix()(Code)
Returns the namespace prefix of the element or an empty string if none exists. the namespace prefix



getNamespaceURI
public String getNamespaceURI()(Code)
Returns the namespace URI mapped to this element's prefix (or the in-scope default namespace URI if no prefix). If no mapping is found, an empty string is returned. the namespace URI for this element



getQualifiedName
public String getQualifiedName()(Code)
Returns the full name of the element, in the form [namespacePrefix]:[localName]. If the element does not have a namespace prefix, then the local name is returned. qualified name of the element (includingnamespace prefix)



getText
public String getText()(Code)
Returns the textual content directly held under this element as a string. This includes all text within this single element, including whitespace and CDATA sections if they exist. It's essentially the concatenation of all Text and CDATA nodes returned by Element.getContent . The call does not recurse into child elements. If no textual value exists for the element, an empty string is returned. text content for this element, or emptystring if none



getTextNormalize
public String getTextNormalize()(Code)
Returns the textual content of this element with all surrounding whitespace removed and internal whitespace normalized to a single space. If no textual value exists for the element, or if only whitespace exists, the empty string is returned. normalized text content for this element, orempty string if none



getTextTrim
public String getTextTrim()(Code)
Returns the textual content of this element with all surrounding whitespace removed. If no textual value exists for the element, or if only whitespace exists, the empty string is returned. trimmed text content for this element, orempty string if none



getValue
public String getValue()(Code)
Returns the XPath 1.0 string value of this element, which is the complete, ordered content of all text node descendants of this element (i.e. the text that's left after all references are resolved and all other markup is stripped out.) a concatentation of all text node descendants



indexOf
public int indexOf(Content child)(Code)



isAncestor
public boolean isAncestor(Element element)(Code)
Determines if this element is the ancestor of another element.
Parameters:
  element - Element to check against true if this element is the ancestor of thesupplied element



isRootElement
public boolean isRootElement()(Code)
Returns whether this element is a root element. This can be used in tandem with Element.getParent to determine if an element has any "attachments" to a parent element or document. whether this is a root element



removeAttribute
public boolean removeAttribute(String name)(Code)

This removes the attribute with the given name and within no namespace. If no such attribute exists, this method does nothing.


Parameters:
  name - name of attribute to remove whether the attribute was removed



removeAttribute
public boolean removeAttribute(String name, Namespace ns)(Code)

This removes the attribute with the given name and within the given Namespace. If no such attribute exists, this method does nothing.


Parameters:
  name - name of attribute to remove
Parameters:
  ns - namespace URI of attribute to remove whether the attribute was removed



removeAttribute
public boolean removeAttribute(Attribute attribute)(Code)

This removes the supplied Attribute should it exist.


Parameters:
  attribute - Reference to the attribute to be removed. whether the attribute was removed



removeChild
public boolean removeChild(String name)(Code)

This removes the first child element (one level deep) with the given local name and belonging to no namespace. Returns true if a child was removed.


Parameters:
  name - the name of child elements to remove whether deletion occurred



removeChild
public boolean removeChild(String name, Namespace ns)(Code)

This removes the first child element (one level deep) with the given local name and belonging to the given namespace. Returns true if a child was removed.


Parameters:
  name - the name of child element to remove
Parameters:
  ns - Namespace to search within whether deletion occurred



removeChildren
public boolean removeChildren(String name)(Code)

This removes all child elements (one level deep) with the given local name and belonging to no namespace. Returns true if any were removed.


Parameters:
  name - the name of child elements to remove whether deletion occurred



removeChildren
public boolean removeChildren(String name, Namespace ns)(Code)

This removes all child elements (one level deep) with the given local name and belonging to the given namespace. Returns true if any were removed.


Parameters:
  name - the name of child elements to remove
Parameters:
  ns - Namespace to search within whether deletion occurred



removeContent
public List removeContent()(Code)
Removes all child content from this parent. list of the old children detached from this parent



removeContent
public List removeContent(Filter filter)(Code)
Remove all child content from this parent matching the supplied filter.
Parameters:
  filter - filter to select which content to remove list of the old children detached from this parent



removeContent
public boolean removeContent(Content child)(Code)



removeContent
public Content removeContent(int index)(Code)



removeNamespaceDeclaration
public void removeNamespaceDeclaration(Namespace additionalNamespace)(Code)
Removes an additional namespace declarations from this element. This should not be used to remove the declaration for this element itself; that should be handled in the construction of the element. Instead, this is for removing namespace declarations on the element not relating directly to itself. If the declaration is not present, this method does nothing.
Parameters:
  additionalNamespace - namespace to remove



setAttribute
public Element setAttribute(String name, String value)(Code)

This sets an attribute value for this element. Any existing attribute with the same name and namespace URI is removed.


Parameters:
  name - name of the attribute to set
Parameters:
  value - value of the attribute to set this element modified
throws:
  IllegalNameException - if the given name is illegal as anattribute name.
throws:
  IllegalDataException - if the given attribute value isillegal character data (as determined byorg.jdom.Verifier.checkCharacterData).



setAttribute
public Element setAttribute(String name, String value, Namespace ns)(Code)

This sets an attribute value for this element. Any existing attribute with the same name and namespace URI is removed.


Parameters:
  name - name of the attribute to set
Parameters:
  value - value of the attribute to set
Parameters:
  ns - namespace of the attribute to set this element modified
throws:
  IllegalNameException - if the given name is illegal as anattribute name, or if the namespace is an unprefixed defaultnamespace
throws:
  IllegalDataException - if the given attribute value isillegal character data (as determined byorg.jdom.Verifier.checkCharacterData).
throws:
  IllegalAddException - if the attribute namespace prefixcollides with another namespace prefix on the element.



setAttribute
public Element setAttribute(Attribute attribute)(Code)

This sets an attribute value for this element. Any existing attribute with the same name and namespace URI is removed.


Parameters:
  attribute - Attribute to set this element modified
throws:
  IllegalAddException - if the attribute being added already has aparent or if the attribute namespace prefix collides with anothernamespace prefix on the element.



setAttributes
public Element setAttributes(List newAttributes)(Code)

This sets the attributes of the element. The supplied List should contain only objects of type Attribute.

When all objects in the supplied List are legal and before the new attributes are added, all old attributes will have their parentage set to null (no parent) and the old attribute list will be cleared. This has the effect that any active attribute list (previously obtained with a call to Element.getAttributes ) will also change to reflect the new attributes. In addition, all attributes in the supplied List will have their parentage set to this element, but the List itself will not be "live" and further removals and additions will have no effect on this elements attributes. If the user wants to continue working with a "live" attribute list, then a call to setAttributes should be followed by a call to Element.getAttributes to obtain a "live" version of the attributes.

Passing a null or empty List clears the existing attributes.

In cases where the List contains duplicate attributes, only the last one will be retained. This has the same effect as calling Element.setAttribute(Attribute) sequentially.

In event of an exception the original attributes will be unchanged and the attributes in the supplied attributes will be unaltered.


Parameters:
  newAttributes - List of attributes to set this element modified
throws:
  IllegalAddException - if the List contains objectsthat are not instances of Attribute,or if any of the Attribute objects haveconflicting namespace prefixes.



setContent
public Element setContent(Collection newContent)(Code)
This sets the content of the element. The supplied List should contain only objects of type Element, Text, CDATA, Comment, ProcessingInstruction, and EntityRef.

When all objects in the supplied List are legal and before the new content is added, all objects in the old content will have their parentage set to null (no parent) and the old content list will be cleared. This has the effect that any active list (previously obtained with a call to Element.getContent or Element.getChildren ) will also change to reflect the new content. In addition, all objects in the supplied List will have their parentage set to this element, but the List itself will not be "live" and further removals and additions will have no effect on this elements content. If the user wants to continue working with a "live" list, then a call to setContent should be followed by a call to Element.getContent or Element.getChildren to obtain a "live" version of the content.

Passing a null or empty List clears the existing content.

In event of an exception the original content will be unchanged and the objects in the supplied content will be unaltered.


Parameters:
  newContent - List of content to set this element modified
throws:
  IllegalAddException - if the List contains objects ofillegal types or with existing parentage.



setContent
public Element setContent(int index, Content child)(Code)
Replace the current child the given index with the supplied child.

In event of an exception the original content will be unchanged and the supplied child will be unaltered.


Parameters:
  index - - index of child to replace.
Parameters:
  child - - child to add. element on which this method was invoked
throws:
  IllegalAddException - if the supplied child is already attachedor not legal content for this parent.
throws:
  IndexOutOfBoundsException - if index is negative or greaterthan the current number of children.



setContent
public Parent setContent(int index, Collection collection)(Code)
Replace the child at the given index whith the supplied collection.

In event of an exception the original content will be unchanged and the content in the supplied collection will be unaltered.


Parameters:
  index - - index of child to replace.
Parameters:
  collection - - collection of content to add. object on which this method was invoked
throws:
  IllegalAddException - if the collection contains objects ofillegal types.
throws:
  IndexOutOfBoundsException - if index is negative or greaterthan the current number of children.



setContent
public Element setContent(Content child)(Code)
Set this element's content to be the supplied child.

If the supplied child is legal content for this parent and before it is added, all content in the current content list will be cleared and all current children will have their parentage set to null.

This has the effect that any active list (previously obtained with a call to one of the Element.getContent methods will also change to reflect the new content. In addition, all content in the supplied collection will have their parentage set to this parent. If the user wants to continue working with a "live" list of this parent's child, then a call to setContent should be followed by a call to one of the Element.getContent methods to obtain a "live" version of the children.

Passing a null child clears the existing content.

In event of an exception the original content will be unchanged and the supplied child will be unaltered.
Parameters:
  child - new content to replace existing content the parent on which the method was called
throws:
  IllegalAddException - if the supplied child is already attachedor not legal content for an Element




setName
public Element setName(String name)(Code)
Sets the (local) name of the element.
Parameters:
  name - the new (local) name of the element the target element
throws:
  IllegalNameException - if the given name is illegal as an Elementname



setNamespace
public Element setNamespace(Namespace namespace)(Code)
Sets the element's Namespace . If the provided namespace is null, the element will have no namespace.
Parameters:
  namespace - the new namespace the target element



setText
public Element setText(String text)(Code)
Sets the content of the element to be the text given. All existing text content and non-text context is removed. If this element should have both textual content and nested elements, use Element.setContent instead. Setting a null text value is equivalent to setting an empty string value.
Parameters:
  text - new text content for the element the target element
throws:
  IllegalDataException - if the assigned text contains an illegalcharacter such as a vertical tab (asdetermined by org.jdom.Verifier.checkCharacterData)



toString
public String toString()(Code)

This returns a String representation of the Element, suitable for debugging. If the XML representation of the Element is desired, org.jdom.output.XMLOutputter.outputString(Element) should be used.

String - information about theElement



Fields inherited from org.jdom.Content
protected Parent parent(Code)(Java Doc)

Methods inherited from org.jdom.Content
public Object clone()(Code)(Java Doc)
public Content detach()(Code)(Java Doc)
final public boolean equals(Object ob)(Code)(Java Doc)
public Document getDocument()(Code)(Java Doc)
public Parent getParent()(Code)(Java Doc)
public Element getParentElement()(Code)(Java Doc)
abstract public String getValue()(Code)(Java Doc)
final public int hashCode()(Code)(Java Doc)
protected Content setParent(Parent parent)(Code)(Java Doc)

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.