|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.resource.Variant
org.restlet.resource.Representation
org.restlet.resource.StreamRepresentation
org.restlet.resource.OutputRepresentation
org.restlet.resource.XmlRepresentation
org.restlet.resource.SaxRepresentation
public class SaxRepresentation
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.
Field Summary |
---|
Fields inherited from class org.restlet.resource.Representation |
---|
UNKNOWN_SIZE |
Constructor Summary | |
---|---|
SaxRepresentation(MediaType mediaType)
Constructor. |
|
SaxRepresentation(MediaType mediaType,
org.w3c.dom.Document xmlDocument)
Constructor. |
|
SaxRepresentation(MediaType mediaType,
org.xml.sax.InputSource xmlSource)
Constructor. |
|
SaxRepresentation(MediaType mediaType,
javax.xml.transform.sax.SAXSource xmlSource)
Constructor. |
|
SaxRepresentation(Representation xmlRepresentation)
Constructor. |
Method Summary | |
---|---|
java.lang.Object |
evaluate(java.lang.String expression,
javax.xml.namespace.QName returnType)
Evaluates an XPath expression and returns the result as in the given return type. |
javax.xml.transform.sax.SAXSource |
getSaxSource()
Returns the SAX source that can be parsed by the parse(ContentHandler) method or used for an XSLT transformation. |
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 |
setSaxSource(javax.xml.transform.sax.SAXSource source)
Sets a SAX source that can be parsed by the parse(ContentHandler) method. |
void |
write(java.io.OutputStream outputStream)
Writes the representation to a byte stream. |
void |
write(XmlWriter writer)
Writes the representation to a XML writer. |
Methods inherited from class org.restlet.resource.XmlRepresentation |
---|
getBoolean, getDocumentBuilder, getDomSource, getNamespaceURI, getNode, getNodes, getNumber, getPrefix, getPrefixes, getSaxSource, getStreamSource, getText, isNamespaceAware, putNamespace, setNamespaceAware, validate, validate, validate, validate |
Methods inherited from class org.restlet.resource.OutputRepresentation |
---|
getStream |
Methods inherited from class org.restlet.resource.StreamRepresentation |
---|
getChannel, getReader, write, write |
Methods inherited from class org.restlet.resource.Representation |
---|
checkDigest, checkDigest, computeDigest, createEmpty, exhaust, getAvailableSize, getDigest, getDownloadName, getExpirationDate, getModificationDate, getRange, getSize, getTag, getText, isAvailable, isDownloadable, isTransient, setAvailable, setDigest, setDownloadable, setDownloadName, setExpirationDate, setModificationDate, setRange, setSize, setTag, setTransient |
Methods inherited from class org.restlet.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 |
---|
public SaxRepresentation(MediaType mediaType)
mediaType
- The representation media type.public SaxRepresentation(MediaType mediaType, org.w3c.dom.Document xmlDocument)
mediaType
- The representation's media type.xmlDocument
- A DOM document to parse.public SaxRepresentation(MediaType mediaType, org.xml.sax.InputSource xmlSource)
mediaType
- The representation's media type.xmlSource
- A SAX input source to parse.public SaxRepresentation(MediaType mediaType, javax.xml.transform.sax.SAXSource xmlSource)
mediaType
- The representation's media type.xmlSource
- A JAXP source to parse.public SaxRepresentation(Representation xmlRepresentation)
xmlRepresentation
- A source XML representation to parse.
java.io.IOException
Method Detail |
---|
public java.lang.Object evaluate(java.lang.String expression, javax.xml.namespace.QName returnType) throws java.lang.Exception
XmlRepresentation
evaluate
in class XmlRepresentation
returnType
- The qualified name of the return type.
java.lang.Exception
XPathException
,
XPathConstants
public javax.xml.transform.sax.SAXSource getSaxSource() throws java.io.IOException
parse(ContentHandler)
method or used for an XSLT transformation.
getSaxSource
in class XmlRepresentation
java.io.IOException
public void parse(org.xml.sax.ContentHandler contentHandler) throws java.io.IOException
contentHandler
- The SAX content handler to use for parsing.
java.io.IOException
public void release()
release
in class XmlRepresentation
public void setSaxSource(javax.xml.transform.sax.SAXSource source)
parse(ContentHandler)
method.
source
- A SAX source.public void write(java.io.OutputStream outputStream) throws java.io.IOException
Representation
write
in class Representation
outputStream
- The output stream.
java.io.IOException
public void write(XmlWriter writer) throws java.io.IOException
writer
- The XML writer to write to.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |