Restlet Framework 2.2.2
Android

org.restlet.ext.xml
Class SaxRepresentation

java.lang.Object
  extended by org.restlet.representation.Variant
      extended by org.restlet.representation.RepresentationInfo
          extended by org.restlet.representation.Representation
              extended by org.restlet.representation.CharacterRepresentation
                  extended by org.restlet.representation.WriterRepresentation
                      extended by org.restlet.ext.xml.XmlRepresentation
                          extended by org.restlet.ext.xml.SaxRepresentation
Direct Known Subclasses:
Categories, Entry, Feed, Service

public class SaxRepresentation
extends XmlRepresentation

XML representation for SAX events processing. The purpose is to create a streamable content based on a custom Java object model instead of a neutral DOM tree. This domain object can then be directly modified and efficiently serialized at a later time.

Subclasses only need to override the ContentHandler methods required for the reading and also the write(XmlWriter writer) method when serialization is requested.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class org.restlet.ext.xml.XmlRepresentation
XML_EXPANDING_ENTITY_REFS, XML_VALIDATING_DTD
 
Fields inherited from class org.restlet.representation.Representation
UNKNOWN_SIZE
 
Constructor Summary
SaxRepresentation(MediaType mediaType)
          Constructor.
SaxRepresentation(MediaType mediaType, org.xml.sax.InputSource xmlSource)
          Constructor.
SaxRepresentation(Representation xmlRepresentation)
          Constructor.
 
Method Summary
 org.xml.sax.InputSource getInputSource()
          Returns the XML representation as a SAX input source.
 void parse(org.xml.sax.ContentHandler contentHandler)
          Parses the source and sends SAX events to a content handler.
 void release()
          Releases the namespaces map.
 void write(java.io.OutputStream outputStream)
           
 void write(java.io.Writer writer)
           
 void write(XmlWriter writer)
          Writes the representation to a XML writer.
 
Methods inherited from class org.restlet.ext.xml.XmlRepresentation
getDocument, getDocumentBuilder, getEntityResolver, getErrorHandler, getNamespaces, getNamespaceURI, getPrefix, getPrefixes, getTextContent, isCoalescing, isExpandingEntityRefs, isIgnoringComments, isIgnoringExtraWhitespaces, isNamespaceAware, isValidatingDtd, isXIncludeAware, setCoalescing, setEntityResolver, setErrorHandler, setExpandingEntityRefs, setIgnoringComments, setIgnoringExtraWhitespaces, setNamespaceAware, setNamespaces, setValidatingDtd, setXIncludeAware
 
Methods inherited from class org.restlet.representation.WriterRepresentation
getReader
 
Methods inherited from class org.restlet.representation.CharacterRepresentation
getChannel, getStream, write
 
Methods inherited from class org.restlet.representation.Representation
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
 
Methods inherited from class org.restlet.representation.RepresentationInfo
getModificationDate, getTag, setModificationDate, setTag
 
Methods inherited from class org.restlet.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

SaxRepresentation

public SaxRepresentation(MediaType mediaType)
Constructor.

Parameters:
mediaType - The representation media type.

SaxRepresentation

public SaxRepresentation(MediaType mediaType,
                         org.xml.sax.InputSource xmlSource)
Constructor.

Parameters:
mediaType - The representation's media type.
xmlSource - A SAX input source to parse.

SaxRepresentation

public SaxRepresentation(Representation xmlRepresentation)
Constructor.

Parameters:
xmlRepresentation - A source XML representation to parse.
Throws:
java.io.IOException
Method Detail

getInputSource

public org.xml.sax.InputSource getInputSource()
                                       throws java.io.IOException
Description copied from class: XmlRepresentation
Returns the XML representation as a SAX input source.

Specified by:
getInputSource in class XmlRepresentation
Returns:
The SAX input source.
Throws:
java.io.IOException

parse

public void parse(org.xml.sax.ContentHandler contentHandler)
           throws java.io.IOException
Parses the source and sends SAX events to a content handler.

Parameters:
contentHandler - The SAX content handler to use for parsing.
Throws:
java.io.IOException

release

public void release()
Releases the namespaces map.

Overrides:
release in class XmlRepresentation

write

public void write(java.io.OutputStream outputStream)
           throws java.io.IOException
Overrides:
write in class CharacterRepresentation
Throws:
java.io.IOException

write

public void write(XmlWriter writer)
           throws java.io.IOException
Writes the representation to a XML writer. The default implementation does nothing and is intended to be overridden.

Parameters:
writer - The XML writer to write to.
Throws:
java.io.IOException

write

public void write(java.io.Writer writer)
           throws java.io.IOException
Specified by:
write in class Representation
Throws:
java.io.IOException

Restlet Framework 2.2.2
Android

Copyright © 2005-2014 Restlet.