Restlet Framework 2.2.1
Google Web Toolkit

org.restlet.client.ext.xml
Class DomRepresentation

java.lang.Object
  extended by org.restlet.client.representation.Variant
      extended by org.restlet.client.representation.RepresentationInfo
          extended by org.restlet.client.representation.Representation
              extended by org.restlet.client.ext.xml.DomRepresentation

public class DomRepresentation
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.client.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
DomRepresentation(MediaType mediaType)
          Constructor for an empty document.
DomRepresentation(MediaType mediaType, Document xmlDocument)
          Constructor from an existing DOM document.
DomRepresentation(Representation xmlRepresentation)
          Constructor.
 
Method Summary
 Document getDocument()
          Returns the wrapped DOM document.
 Reader getReader()
           
 InputStream getStream()
           
 String getText()
           
 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.client.representation.Representation
append, exhaust, getAvailableSize, getDisposition, getExpirationDate, getRange, getSize, hasKnownSize, isAvailable, isEmpty, isTransient, setAvailable, setDisposition, setExpirationDate, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.client.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.client.representation.Variant
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DomRepresentation

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

Parameters:
mediaType - The representation's media type.

DomRepresentation

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

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

DomRepresentation

public DomRepresentation(Representation xmlRepresentation)
Constructor.

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

getDocument

public Document getDocument()
                     throws IOException
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.
Throws:
IOException

getReader

public Reader getReader()
                 throws IOException
Specified by:
getReader in class Representation
Throws:
IOException

getStream

public InputStream getStream()
                      throws IOException
Specified by:
getStream in class Representation
Throws:
IOException

getText

public String getText()
               throws IOException
Specified by:
getText in class Representation
Throws:
IOException

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.

Restlet Framework 2.2.1
Google Web Toolkit

Copyright © 2005-2014 Restlet.