|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.storage.serializers.Serializer
This is the base class for all serializers. Serializers are used to serialize a document or document fragment back to XML. A serializer may be obtained by calling DBBroker.getSerializer(). The class basically offers two overloaded methods: serialize() and toSAX(). serialize() returns the XML as a string, while toSAX() generates a stream of SAX events. The stream of SAX events is passed to the ContentHandler set by setContentHandler(). serialize() internally calls toSAX() and uses a Xerces XML Writer to consume the stream. If the processXInclude property is set, XInclude elements in the source document will be expanded.
Field Summary | |
protected DBBroker |
broker
|
protected org.xml.sax.ContentHandler |
contentHandler
|
protected boolean |
createContainerElements
|
protected org.xml.sax.DTDHandler |
dtdHandler
|
protected java.lang.String |
encoding
|
static java.lang.String |
ENCODING
|
static java.lang.String |
EXIST_NS
|
static java.lang.String |
EXPAND_XINCLUDES
|
protected javax.xml.transform.TransformerFactory |
factory
|
static java.lang.String |
GENERATE_DOC_EVENTS
|
protected boolean |
generateDocEvents
|
static java.lang.String |
HIGHLIGHT_MATCHES
|
protected int |
highlightMatches
|
protected boolean |
indent
|
protected org.xml.sax.ext.LexicalHandler |
lexicalHandler
|
protected static org.apache.log4j.Logger |
LOG
|
static java.lang.String |
PRETTY_PRINT
|
protected boolean |
processXInclude
|
protected boolean |
processXSL
|
static int |
TAG_ATTRIBUTE_MATCHES
|
static int |
TAG_BOTH
|
static int |
TAG_ELEMENT_MATCHES
|
static int |
TAG_NONE
|
protected javax.xml.transform.Templates |
templates
|
protected User |
user
|
protected XIncludeFilter |
xinclude
|
protected javax.xml.transform.sax.TransformerHandler |
xslHandler
|
Constructor Summary | |
Serializer(DBBroker broker,
Configuration config)
Constructor for the Serializer object |
Method Summary | |
protected java.io.StringWriter |
applyXSLHandler()
If an XSL stylesheet is present, plug it into the chain. |
org.xml.sax.ContentHandler |
getContentHandler()
Return the current ContentHandler |
org.xml.sax.DTDHandler |
getDTDHandler()
Return the current DTDHandler |
org.xml.sax.EntityResolver |
getEntityResolver()
Return my internal EntityResolver |
org.xml.sax.ErrorHandler |
getErrorHandler()
Return my ErrorHandler |
boolean |
getFeature(java.lang.String name)
Gets the feature attribute of the Serializer object |
java.lang.Object |
getProperty(java.lang.String name)
Gets the property attribute of the Serializer object |
User |
getUser()
Get the current User. |
void |
parse(org.xml.sax.InputSource input)
Description of the Method |
void |
parse(java.lang.String systemId)
Description of the Method |
void |
reset()
Reset the class to its initial state. |
java.lang.String |
serialize(org.w3c.dom.Document doc)
Serialize a document |
java.lang.String |
serialize(org.w3c.dom.Node n)
Serialize a single node |
java.lang.String |
serialize(NodeProxy p)
Serialize a single NodeProxy |
java.lang.String |
serialize(NodeSet set,
int start,
int howmany)
Serialize a set of nodes |
java.lang.String |
serialize(NodeSet set,
int start,
int howmany,
long queryTime)
Serialize a set of nodes |
protected void |
serializeToSAX(org.w3c.dom.Document doc,
boolean generateDocEvent)
Serialize a document to a SAX stream |
protected void |
serializeToSAX(org.w3c.dom.Node n,
boolean generateDocEvents)
Serialize a single Node to the SAX stream |
protected void |
serializeToSAX(NodeProxy p,
boolean generateDocEvents)
Serialize a single NodeProxy to the SAX stream |
protected void |
serializeToSAX(NodeSet set,
int start,
int howmany,
long queryTime)
Serialize a NodeSet to the SAX stream |
void |
setContentHandler(org.xml.sax.ContentHandler handler)
Set the ContentHandler to be used during serialization. |
protected void |
setDocument(DocumentImpl doc)
|
void |
setDTDHandler(org.xml.sax.DTDHandler handler)
Set the DTDHandler to be used during serialization. |
void |
setEntityResolver(org.xml.sax.EntityResolver resolver)
Sets the entityResolver attribute of the Serializer object |
void |
setErrorHandler(org.xml.sax.ErrorHandler handler)
Sets the errorHandler attribute of the Serializer object |
void |
setFeature(java.lang.String name,
boolean value)
Sets the feature attribute of the Serializer object |
void |
setLexicalHandler(org.xml.sax.ext.LexicalHandler lexicalHandler)
Sets the lexicalHandler attribute of the Serializer object |
protected java.io.StringWriter |
setPrettyPrinter(boolean xmlDecl)
Sets the prettyPrinter attribute of the Serializer object |
void |
setProperties(java.util.Map properties)
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets the property attribute of the Serializer object |
void |
setStylesheet(DocumentImpl doc,
java.lang.String stylesheet)
Sets the stylesheet attribute of the Serializer object |
void |
setStylesheet(java.lang.String stylesheet)
|
void |
setUser(User user)
Set the current User. |
protected void |
setXSLHandler()
Sets the xSLHandler attribute of the Serializer object |
void |
toSAX(org.w3c.dom.Document doc)
Serialize document to SAX stream |
void |
toSAX(org.w3c.dom.Node n)
Description of the Method |
void |
toSAX(NodeProxy p)
Description of the Method |
void |
toSAX(NodeSet set,
int start,
int howmany)
Description of the Method |
void |
toSAX(NodeSet set,
int start,
int howmany,
long queryTime)
Description of the Method |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final org.apache.log4j.Logger LOG
public static final java.lang.String EXIST_NS
public static final int TAG_NONE
public static final int TAG_ELEMENT_MATCHES
public static final int TAG_ATTRIBUTE_MATCHES
public static final int TAG_BOTH
public static final java.lang.String PRETTY_PRINT
public static final java.lang.String GENERATE_DOC_EVENTS
public static final java.lang.String ENCODING
public static final java.lang.String EXPAND_XINCLUDES
public static final java.lang.String HIGHLIGHT_MATCHES
protected DBBroker broker
protected java.lang.String encoding
protected javax.xml.transform.TransformerFactory factory
protected boolean indent
protected boolean createContainerElements
protected boolean processXInclude
protected boolean processXSL
protected boolean generateDocEvents
protected int highlightMatches
protected javax.xml.transform.Templates templates
protected javax.xml.transform.sax.TransformerHandler xslHandler
protected XIncludeFilter xinclude
protected org.xml.sax.ContentHandler contentHandler
protected org.xml.sax.DTDHandler dtdHandler
protected org.xml.sax.ext.LexicalHandler lexicalHandler
protected User user
Constructor Detail |
public Serializer(DBBroker broker, Configuration config)
broker
- Description of the ParameterMethod Detail |
public void setProperties(java.util.Map properties)
protected java.io.StringWriter applyXSLHandler()
public org.xml.sax.ContentHandler getContentHandler()
getContentHandler
in interface org.xml.sax.XMLReader
public org.xml.sax.DTDHandler getDTDHandler()
getDTDHandler
in interface org.xml.sax.XMLReader
public org.xml.sax.EntityResolver getEntityResolver()
getEntityResolver
in interface org.xml.sax.XMLReader
public org.xml.sax.ErrorHandler getErrorHandler()
getErrorHandler
in interface org.xml.sax.XMLReader
public void setUser(User user)
public User getUser()
public boolean getFeature(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getFeature
in interface org.xml.sax.XMLReader
name
- Description of the Parameter
org.xml.sax.SAXNotRecognizedException
- Description of the Exception
org.xml.sax.SAXNotSupportedException
- Description of the Exceptionpublic java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
getProperty
in interface org.xml.sax.XMLReader
name
- Description of the Parameter
org.xml.sax.SAXNotRecognizedException
- Description of the Exception
org.xml.sax.SAXNotSupportedException
- Description of the Exceptionpublic void parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException
parse
in interface org.xml.sax.XMLReader
input
- Description of the Parameter
java.io.IOException
- Description of the Exception
org.xml.sax.SAXException
- Description of the Exceptionprotected void setDocument(DocumentImpl doc)
public void parse(java.lang.String systemId) throws java.io.IOException, org.xml.sax.SAXException
parse
in interface org.xml.sax.XMLReader
systemId
- Description of the Parameter
java.io.IOException
- Description of the Exception
org.xml.sax.SAXException
- Description of the Exceptionpublic void reset()
public java.lang.String serialize(NodeSet set, int start, int howmany) throws org.xml.sax.SAXException
set
- Description of the Parameterstart
- Description of the Parameterhowmany
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic java.lang.String serialize(NodeSet set, int start, int howmany, long queryTime) throws org.xml.sax.SAXException
set
- Description of the Parameterstart
- Description of the Parameterhowmany
- Description of the ParameterqueryTime
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic java.lang.String serialize(org.w3c.dom.Document doc) throws org.xml.sax.SAXException
doc
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic java.lang.String serialize(org.w3c.dom.Node n) throws org.xml.sax.SAXException
n
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic java.lang.String serialize(NodeProxy p) throws org.xml.sax.SAXException
p
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionprotected void serializeToSAX(org.w3c.dom.Document doc, boolean generateDocEvent) throws org.xml.sax.SAXException
doc
- Description of the ParametergenerateDocEvent
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionprotected void serializeToSAX(NodeSet set, int start, int howmany, long queryTime) throws org.xml.sax.SAXException
set
- Description of the Parameterstart
- Description of the Parameterhowmany
- Description of the ParameterqueryTime
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionprotected void serializeToSAX(org.w3c.dom.Node n, boolean generateDocEvents) throws org.xml.sax.SAXException
n
- Description of the ParametergenerateDocEvents
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionprotected void serializeToSAX(NodeProxy p, boolean generateDocEvents) throws org.xml.sax.SAXException
p
- Description of the ParametergenerateDocEvents
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic void setContentHandler(org.xml.sax.ContentHandler handler)
setContentHandler
in interface org.xml.sax.XMLReader
public void setDTDHandler(org.xml.sax.DTDHandler handler)
setDTDHandler
in interface org.xml.sax.XMLReader
handler
- The new dTDHandler valuepublic void setEntityResolver(org.xml.sax.EntityResolver resolver)
setEntityResolver
in interface org.xml.sax.XMLReader
resolver
- The new entityResolver valuepublic void setErrorHandler(org.xml.sax.ErrorHandler handler)
setErrorHandler
in interface org.xml.sax.XMLReader
handler
- The new errorHandler valuepublic void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setFeature
in interface org.xml.sax.XMLReader
name
- The new feature valuevalue
- The new feature value
org.xml.sax.SAXNotRecognizedException
- Description of the Exception
org.xml.sax.SAXNotSupportedException
- Description of the Exceptionpublic void setLexicalHandler(org.xml.sax.ext.LexicalHandler lexicalHandler)
lexicalHandler
- The new lexicalHandler valueprotected java.io.StringWriter setPrettyPrinter(boolean xmlDecl)
xmlDecl
- The new prettyPrinter value
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
setProperty
in interface org.xml.sax.XMLReader
name
- The new property valuevalue
- The new property value
org.xml.sax.SAXNotRecognizedException
- Description of the Exception
org.xml.sax.SAXNotSupportedException
- Description of the Exceptionpublic void setStylesheet(java.lang.String stylesheet)
public void setStylesheet(DocumentImpl doc, java.lang.String stylesheet)
stylesheet
- The new stylesheet value
org.xml.sax.SAXException
- Description of the
Exception
javax.xml.transform.TransformerConfigurationException
- Description of the
Exceptionprotected void setXSLHandler()
public void toSAX(NodeSet set, int start, int howmany) throws org.xml.sax.SAXException
set
- Description of the Parameterstart
- Description of the Parameterhowmany
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic void toSAX(NodeSet set, int start, int howmany, long queryTime) throws org.xml.sax.SAXException
set
- Description of the Parameterstart
- Description of the Parameterhowmany
- Description of the ParameterqueryTime
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic void toSAX(org.w3c.dom.Document doc) throws org.xml.sax.SAXException
doc
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic void toSAX(org.w3c.dom.Node n) throws org.xml.sax.SAXException
n
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exceptionpublic void toSAX(NodeProxy p) throws org.xml.sax.SAXException
p
- Description of the Parameter
org.xml.sax.SAXException
- Description of the Exception
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |