Java Doc for Document.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.Document

Document
public class Document implements Parent(Code)
An XML document. Methods allow access to the root element as well as the DocType and other document-level information.
version:
   $Revision: 1.1 $, $Date: 2005/04/27 09:32:39 $
author:
   Brett McLaughlin
author:
   Jason Hunter
author:
   Jools Enticknap
author:
   Bradley S. Huffman


Field Summary
protected  StringbaseURI
    
 ContentListcontent
     This document's content including comments, PIs, a possible DocType, and a root element.

Constructor Summary
public  Document()
     Creates a new empty document.
public  Document(Element rootElement, DocType docType, String baseURI)
     This will create a new Document, with the supplied Element as the root element, the supplied DocType declaration, and the specified base URI.
public  Document(Element rootElement, DocType docType)
     This will create a new Document, with the supplied Element as the root element and the supplied DocType declaration.
public  Document(Element rootElement)
     This will create a new Document, with the supplied Element as the root element, and no DocType declaration.
public  Document(List content)
     This will create a new Document, with the supplied list of content, and a DocType declaration only if the content contains a DocType instance.

Method Summary
public  DocumentaddContent(Content child)
     Appends the child to the end of the content list.
public  DocumentaddContent(Collection c)
     Appends all children in the given collection to the end of the content list.
public  DocumentaddContent(int index, Content child)
     Inserts the child into the content list at the given index.
public  DocumentaddContent(int index, Collection c)
     Inserts the content in a collection into the content list at the given index.
public  Objectclone()
     This will return a deep clone of this Document.
public  ListcloneContent()
    
public  ElementdetachRootElement()
     Detach the root Element from this document.
final public  booleanequals(Object ob)
     This tests for equality of this Document to the supplied Object.
final public  StringgetBaseURI()
    

Returns the URI from which this document was loaded, or null if this is not known.

public  ContentgetContent(int index)
    
public  ListgetContent()
     This will return all content for the Document.
public  ListgetContent(Filter filter)
     Return a filtered view of this Document's content.
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  DocTypegetDocType()
     This will return the DocType declaration for this Document, or null if none exists.
public  DocumentgetDocument()
    
public  ParentgetParent()
    
public  ObjectgetProperty(String id)
     Returns the object associated with this document under the given "id" string, or null if there is no binding or if the binding explicitly stored a null value.
public  ElementgetRootElement()
    
public  booleanhasRootElement()
     This will return true if this document has a root element, false otherwise.
final public  inthashCode()
     This returns the hash code for this Document.
public  intindexOf(Content child)
    
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)
    
final public  voidsetBaseURI(String uri)
    

Sets the effective URI from which this document was loaded, and against which relative URLs in this document will be resolved.

public  DocumentsetContent(Collection newContent)
     This sets the content of the Document.
public  DocumentsetContent(int index, Content child)
    
public  DocumentsetContent(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  DocumentsetContent(Content child)
     Set this document's content to be the supplied child.

If the supplied child is legal content for a Document 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 Document.getContent methods will also change to reflect the new content.

public  DocumentsetDocType(DocType docType)
     This will set the DocType declaration for this Document.
public  voidsetProperty(String id, Object value)
     Assigns an arbitrary object to be associated with this document under the given "id" string.
public  DocumentsetRootElement(Element rootElement)
     This sets the root Element for the Document.
public  StringtoString()
     This returns a String representation of the Document, suitable for debugging.

Field Detail
baseURI
protected String baseURI(Code)
See http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/core.html#baseURIs-Considerations



content
ContentList content(Code)
This document's content including comments, PIs, a possible DocType, and a root element. Subclassers have to track content using their own mechanism.




Constructor Detail
Document
public Document()(Code)
Creates a new empty document. A document must have a root element, so this document will not be well-formed and accessor methods will throw an IllegalStateException if this document is accessed before a root element is added. This method is most useful for build tools.



Document
public Document(Element rootElement, DocType docType, String baseURI)(Code)
This will create a new Document, with the supplied Element as the root element, the supplied DocType declaration, and the specified base URI.
Parameters:
  rootElement - Element for document root.
Parameters:
  docType - DocType declaration.
Parameters:
  baseURI - the URI from which this doucment was loaded.
throws:
  IllegalAddException - if the given docType objectis already attached to a document or the givenrootElement already has a parent



Document
public Document(Element rootElement, DocType docType)(Code)
This will create a new Document, with the supplied Element as the root element and the supplied DocType declaration.
Parameters:
  rootElement - Element for document root.
Parameters:
  docType - DocType declaration.
throws:
  IllegalAddException - if the given DocType objectis already attached to a document or the givenrootElement already has a parent



Document
public Document(Element rootElement)(Code)
This will create a new Document, with the supplied Element as the root element, and no DocType declaration.
Parameters:
  rootElement - Element for document root
throws:
  IllegalAddException - if the given rootElement already hasa parent.



Document
public Document(List content)(Code)
This will create a new Document, with the supplied list of content, and a DocType declaration only if the content contains a DocType instance. A null list is treated the same as the no-arg constructor.
Parameters:
  content - List of starter content
throws:
  IllegalAddException - if the List contains more thanone Element or objects of illegal types.




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



addContent
public Document addContent(Collection c)(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:
  c - collection to append the document on which the method was called
throws:
  IllegalAddException - if any item in the collectionalready has a parent or is of an illegal type.



addContent
public Document 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 Document 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 illegal type.



clone
public Object clone()(Code)
This will return a deep clone of this Document. Object clone of this Document



cloneContent
public List cloneContent()(Code)



detachRootElement
public Element detachRootElement()(Code)
Detach the root Element from this document. removed root Element



equals
final public boolean equals(Object ob)(Code)
This tests for equality of this Document to the supplied Object.
Parameters:
  ob - Object to compare to boolean whether the Document isequal to the supplied Object



getBaseURI
final public String getBaseURI()(Code)

Returns the URI from which this document was loaded, or null if this is not known.

the base URI of this document



getContent
public Content getContent(int index)(Code)



getContent
public List getContent()(Code)
This will return all content for the Document. The returned list is "live" in document order and changes to it affect the document's actual 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.

List - all Document content
throws:
  IllegalStateException - if the root element hasn't been set



getContent
public List getContent(Filter filter)(Code)
Return a filtered view of this Document'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 Document content
throws:
  IllegalStateException - if the root element hasn't been set



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



getDocType
public DocType getDocType()(Code)
This will return the DocType declaration for this Document, or null if none exists. DocType - the DOCTYPE declaration.



getDocument
public Document getDocument()(Code)

See Also:   org.jdom.Parent.getDocument



getParent
public Parent getParent()(Code)



getProperty
public Object getProperty(String id)(Code)
Returns the object associated with this document under the given "id" string, or null if there is no binding or if the binding explicitly stored a null value.
Parameters:
  id - the id of the stored object to return the object associated with the given id



getRootElement
public Element getRootElement()(Code)
This will return the root Element for this Document Element - the document's root element
throws:
  IllegalStateException - if the root element hasn't been set



hasRootElement
public boolean hasRootElement()(Code)
This will return true if this document has a root element, false otherwise. true if this document has a root element,false otherwise.



hashCode
final public int hashCode()(Code)
This returns the hash code for this Document. int hash code



indexOf
public int indexOf(Content child)(Code)



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)



setBaseURI
final public void setBaseURI(String uri)(Code)

Sets the effective URI from which this document was loaded, and against which relative URLs in this document will be resolved.


Parameters:
  uri - the base URI of this document



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

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 Document.getContent ) will also change to reflect the new content. In addition, all objects in the supplied List will have their parentage set to this document, but the List itself will not be "live" and further removals and additions will have no effect on this document content. If the user wants to continue working with a "live" list, then a call to setContent should be followed by a call to Document.getContent 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 document modified
throws:
  IllegalAddException - if the List contains objects ofillegal types or with existing parentage.



setContent
public Document setContent(int index, Content child)(Code)



setContent
public Document 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 the 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 Document setContent(Content child)(Code)
Set this document's content to be the supplied child.

If the supplied child is legal content for a Document 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 Document.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 Document. If the user wants to continue working with a "live" list of this Document's child, then a call to setContent should be followed by a call to one of the Document.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 this parent




setDocType
public Document setDocType(DocType docType)(Code)
This will set the DocType declaration for this Document. Note that a DocType can only be attached to one Document. Attempting to set the DocType to a DocType object that already belongs to a Document will result in an IllegalAddException being thrown.
Parameters:
  docType - DocType declaration. object on which the method was invoked
throws:
  IllegalAddException - if the given docType isalready attached to a Document.



setProperty
public void setProperty(String id, Object value)(Code)
Assigns an arbitrary object to be associated with this document under the given "id" string. Null values are permitted. Strings beginning with "http://www.jdom.org/ are reserved for JDOM use.
Parameters:
  id - the id of the stored object
Parameters:
  value - the object to store



setRootElement
public Document setRootElement(Element rootElement)(Code)
This sets the root Element for the Document. If the document already has a root element, it is replaced.
Parameters:
  rootElement - Element to be new root. Document - modified Document.
throws:
  IllegalAddException - if the given rootElement already hasa parent.



toString
public String toString()(Code)
This returns a String representation of the Document, suitable for debugging. If the XML representation of the Document is desired, org.jdom.output.XMLOutputter.outputString(Document) should be used. String - information about theDocument



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.