org.restlet.gwt.resource
Class XmlRepresentation

java.lang.Object
  extended by org.restlet.gwt.resource.Variant
      extended by org.restlet.gwt.resource.Representation
          extended by org.restlet.gwt.resource.XmlRepresentation

public class XmlRepresentation
extends Representation

XML representation based on an XML DOM document. DOM is a standard XML object model defined by the W3C.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.gwt.resource.Representation
UNKNOWN_SIZE
 
Constructor Summary
XmlRepresentation(MediaType mediaType)
          Constructor for an empty document.
XmlRepresentation(MediaType mediaType, Document xmlDocument)
          Constructor from an existing DOM document.
XmlRepresentation(Representation xmlRepresentation)
          Constructor.
 
Method Summary
 Document getDocument()
          Returns the wrapped DOM document.
 java.lang.String getText()
          Converts the representation to a string value.
 void release()
          Releases the wrapped DOM document and the source XML representation if they have been defined.
 void setDocument(Document dom)
          Sets the wrapped DOM document.
 
Methods inherited from class org.restlet.gwt.resource.Representation
createEmpty, getDownloadName, getExpirationDate, getModificationDate, getSize, getTag, isAvailable, isDownloadable, isTransient, setAvailable, setDownloadable, setDownloadName, setExpirationDate, setModificationDate, setSize, setTag, setTransient
 
Methods inherited from class org.restlet.gwt.resource.Variant
getCharacterSet, getEncodings, getIdentifier, getLanguages, getMediaType, setCharacterSet, setEncodings, setIdentifier, setIdentifier, setLanguages, setMediaType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRepresentation

public XmlRepresentation(MediaType mediaType)
Constructor for an empty document.

Parameters:
mediaType - The representation's media type.

XmlRepresentation

public XmlRepresentation(MediaType mediaType,
                         Document xmlDocument)
Constructor from an existing DOM document.

Parameters:
mediaType - The representation's media type.
xmlDocument - The source DOM document.

XmlRepresentation

public XmlRepresentation(Representation xmlRepresentation)
Constructor.

Parameters:
xmlRepresentation - A source XML representation to parse.
Method Detail

getDocument

public Document getDocument()
Returns the wrapped DOM document. If no document is defined yet, it attempts to parse the XML representation eventually given at construction time. Otherwise, it just creates a new document.

Returns:
The wrapped DOM document.

getText

public java.lang.String getText()
Description copied from class: Representation
Converts the representation to a string value. Be careful when using this method as the conversion of large content to a string fully stored in memory can result in OutOfMemoryErrors being thrown.

Specified by:
getText in class Representation
Returns:
The representation as a string value.

release

public void release()
Releases the wrapped DOM document and the source XML representation if they have been defined.

Overrides:
release in class Representation

setDocument

public void setDocument(Document dom)
Sets the wrapped DOM document.

Parameters:
dom - The wrapped DOM document.


Copyright © 2005-2008 Noelios Technologies.