Java Doc for XElement.java in  » EJB-Server-JBoss-4.2.1 » messaging » org » jboss » mq » xml » 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 » EJB Server JBoss 4.2.1 » messaging » org.jboss.mq.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jboss.mq.xml.XElement

XElement
public class XElement (Code)
XElement provides an interface to an XML element. An XElement represents an XML element which contains:
  • Name (required)
  • Attributes (optional)
  • character data (optional)
  • other elements (optional)

It is important to understand the diffrence between an "field" XElement and a non "field" XElement. If an XElement does not contain any sub elements, it is considered a "field" XElement. The getField(String) and getValue() functions will throw an XElementException if they are used on non "attribute" objects. This give you a little bit type checking (You'll get an exception if you try to access the character data of an element that has sub elements).

If XElement is not an field, then it contains other XElements and optionaly some text. The text data can be accessed with the getText() method and the sub elements with the iterator() or with getElementXXX() fuctions. Since XML and thus XElements provide a tree type data structure, traversing the tree to access leaf data can be cumbersom if you have a 'deep' tree. For example, you may have to do: element.getElement("tree").getElement("branch").getElement("leaf") access a XElement 3 levels deep in the tree. To access deep elements easier, XElements lets you use 'reletive' names to access deep elements. Using reletive names, you could access the same element in previous example doing: element.getElement("tree/branch/leaf") When using relative names, keep in mind that "." will get the current XElement, and ".." will get parent XElement. Very similar to how URLs work.
author:
   Hiram Chirino (Cojonudo14@hotmail.com)
version:
   $Revision: 57198 $




Constructor Summary
public  XElement(String objectName)
     Constructs an empty object.
public  XElement(String objectName, Attributes atts)
     Constructs an XElement with it's parent and metatags set.

Method Summary
public  voidadd(String data)
     Adds and appends string data to the objects text.
public  voidaddElement(XElement subObject)
     Adds an XElement to the set of XElements that are contained by this object.
public  voidaddField(String key, String value)
     Adds an XElement to the set of XElements that are contained by this object.
public  booleancontainsElement(String objectName)
     Tests to see if this object contains the specified object.
Parameters:
  objectName - The name of the object.
public  booleancontainsField(String objectName)
     Tests to see if this object contains the specified attribute object.
Parameters:
  objectName - The name of the attribute object.
public static  XElementcreateFrom(java.io.InputStream is)
     Constructs an empty object.
public static  XElementcreateFrom(java.net.URL url)
     Constructs an empty object.
public  Enumerationelements()
    
public  StringgetAttribute(String key)
     Returns the value of a meta data value.
public  XElementgetElement(String relativeName)
     Returns the first object contained in this object named relativeName.
public  java.util.EnumerationgetElementsNamed(String relativeName)
     Returns all the contained objects with the specified name.
public  StringgetField(String objectName)
     Gets the value of a contained attribute object.
Parameters:
  objectName - The name of the attribute object.
public  java.lang.StringgetName()
    
public  StringgetOptionalField(String field)
    
public  XElementgetParent()
     Get the parent of this object, or the object the contains this one.
public  StringgetText()
     Gets the TRIMMED character data that was within this object.
public  StringgetValue()
     Gets the character data that was within this object.
public  booleanisField()
     Returns true if the object is an attribute object.
public  voidremoveFromParent()
     Removes this XElement from the parent.
public  voidsetAttribute(String key, String value)
     Sets/Adds a metatag value Only metatags whose value is not empty will display when the toString() methods is called.
public  voidsetField(String key, String value)
    
public  voidsetName(String newName)
    
public  voidsetOptionalField(String field, String value)
    
public  voidsetValue(String value)
     Gets the character data that was within this object.
public  StringtoString()
     Serializes this object into a string.
public  StringtoString(int nestingLevel, boolean indent)
     Serializes this object into a string.
public  StringtoXML(boolean indent)
     Serializes this object into a XML document String.


Constructor Detail
XElement
public XElement(String objectName)(Code)
Constructs an empty object.
Parameters:
  objectName - the tag or element name that this object represents.



XElement
public XElement(String objectName, Attributes atts)(Code)
Constructs an XElement with it's parent and metatags set.
Parameters:
  objectName - the tag or element name that this object represents.
Parameters:
  atts - Description of Parameter




Method Detail
add
public void add(String data)(Code)
Adds and appends string data to the objects text.
Parameters:
  data - Description of Parameter



addElement
public void addElement(XElement subObject)(Code)
Adds an XElement to the set of XElements that are contained by this object.
Parameters:
  subObject -



addField
public void addField(String key, String value)(Code)
Adds an XElement to the set of XElements that are contained by this object.
Parameters:
  key - The feature to be added to the Field attribute
Parameters:
  value - The feature to be added to the Field attribute



containsElement
public boolean containsElement(String objectName)(Code)
Tests to see if this object contains the specified object.
Parameters:
  objectName - The name of the object. Description of the Returned Value



containsField
public boolean containsField(String objectName)(Code)
Tests to see if this object contains the specified attribute object.
Parameters:
  objectName - The name of the attribute object. Description of the Returned Value



createFrom
public static XElement createFrom(java.io.InputStream is) throws XElementException, java.io.IOException(Code)
Constructs an empty object.
Parameters:
  is - Description of Parameter Description of the Returned Value
exception:
  XElementException - Description of Exception
exception:
  java.io.IOException - Description of Exception



createFrom
public static XElement createFrom(java.net.URL url) throws XElementException, java.io.IOException(Code)
Constructs an empty object.
Parameters:
  url - Description of Parameter Description of the Returned Value
exception:
  XElementException - Description of Exception
exception:
  java.io.IOException - Description of Exception



elements
public Enumeration elements()(Code)
Description of the Returned Value



getAttribute
public String getAttribute(String key)(Code)
Returns the value of a meta data value.
Parameters:
  key - Description of Parameter The Attribute value



getElement
public XElement getElement(String relativeName) throws XElementException(Code)
Returns the first object contained in this object named relativeName.
Parameters:
  relativeName - The name of the object to find The Element value
throws:
  XElementException - if the object could not be found.



getElementsNamed
public java.util.Enumeration getElementsNamed(String relativeName)(Code)
Returns all the contained objects with the specified name.
Parameters:
  relativeName - The name of the objects The ElementsNamed value



getField
public String getField(String objectName) throws XElementException(Code)
Gets the value of a contained attribute object.
Parameters:
  objectName - The name of the attribute object. The Field value
throws:
  XElementException - if the object does not exist or if its not anattribute object.



getName
public java.lang.String getName()(Code)
Returns the element name (tag name) of this XElement The Name value



getOptionalField
public String getOptionalField(String field) throws XElementException(Code)



getParent
public XElement getParent()(Code)
Get the parent of this object, or the object the contains this one. The Parent value



getText
public String getText()(Code)
Gets the TRIMMED character data that was within this object. This differs from getValue() in that:
  • this fuction will work on attribute and non attribute XElements
  • it will trim both ends of the character data before returning it.
The Text value



getValue
public String getValue() throws XElementException(Code)
Gets the character data that was within this object. This fuction can only be used on objects that are attributes. The Value value
throws:
  XElementException - if the object was not an attribute object



isField
public boolean isField()(Code)
Returns true if the object is an attribute object. An object is an attribute object if it does not contain any other objects. The Field value



removeFromParent
public void removeFromParent() throws XElementException(Code)
Removes this XElement from the parent.
throws:
  XElementException - if the object did not have a parent



setAttribute
public void setAttribute(String key, String value)(Code)
Sets/Adds a metatag value Only metatags whose value is not empty will display when the toString() methods is called.
Parameters:
  key - the name of the metatag
Parameters:
  value - the value to set the metatag to.



setField
public void setField(String key, String value) throws XElementException(Code)
Sets/Adds a attribute
Parameters:
  key - the name of the attribute element
Parameters:
  value - the value to set the attribute to.
exception:
  XElementException - Description of Exception



setName
public void setName(String newName)(Code)
Sets the object name
Parameters:
  newName -



setOptionalField
public void setOptionalField(String field, String value) throws XElementException(Code)



setValue
public void setValue(String value) throws XElementException(Code)
Gets the character data that was within this object. This fuction can only be used on objects that are attributes.
Parameters:
  value - The new Value value
throws:
  XElementException - if the object was not an attribute object



toString
public String toString()(Code)
Serializes this object into a string. Description of the Returned Value



toString
public String toString(int nestingLevel, boolean indent)(Code)
Serializes this object into a string.
Parameters:
  nestingLevel - how many tabs to prepend to output
Parameters:
  indent - Description of Parameter Description of the Returned Value



toXML
public String toXML(boolean indent)(Code)
Serializes this object into a XML document String.
Parameters:
  indent - Description of Parameter Description of the Returned Value



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.