|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.storage.serializers.Serializer
public abstract class Serializer
Serializer base class, 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().
Internally, both types of methods pass events to a Receiver.
Subclasses thus have to implement the various serializeToReceiver() methods.
Output can be configured through properties. Property keys are defined in classes
OutputKeys and EXistOutputKeys
| Nested Class Summary | |
|---|---|
class |
Serializer.HttpContext
|
| Field Summary | |
|---|---|
static String |
ADD_EXIST_ID_ATTRIBUTE
|
static String |
COMPRESS_OUTPUT_ATTRIBUTE
|
static String |
CONFIGURATION_ELEMENT_NAME
|
static String |
ENABLE_XINCLUDE_ATTRIBUTE
|
static String |
ENABLE_XSL_ATTRIBUTE
|
static String |
ENCODING
|
static int |
EXIST_ID_ALL
|
static int |
EXIST_ID_ELEMENT
|
static int |
EXIST_ID_NONE
|
static String |
GENERATE_DOC_EVENTS
|
static String |
INDENT_ATTRIBUTE
|
static String |
PROPERTY_ADD_EXIST_ID
|
static String |
PROPERTY_COMPRESS_OUTPUT
|
static String |
PROPERTY_ENABLE_XINCLUDE
|
static String |
PROPERTY_ENABLE_XSL
|
static String |
PROPERTY_INDENT
|
static String |
PROPERTY_SESSION_ID
|
static String |
PROPERTY_TAG_MATCHING_ATTRIBUTES
|
static String |
PROPERTY_TAG_MATCHING_ELEMENTS
|
static int |
TAG_ATTRIBUTE_MATCHES
|
static int |
TAG_BOTH
|
static int |
TAG_ELEMENT_MATCHES
|
static String |
TAG_MATCHING_ATTRIBUTES_ATTRIBUTE
|
static String |
TAG_MATCHING_ELEMENTS_ATTRIBUTE
|
static int |
TAG_NONE
|
| Constructor Summary | |
|---|---|
Serializer(DBBroker broker,
Configuration config)
|
|
| Method Summary | |
|---|---|
ContentHandler |
getContentHandler()
Required by interface XMLReader. |
DTDHandler |
getDTDHandler()
Inherited from XMLReader. |
EntityResolver |
getEntityResolver()
Return my internal EntityResolver |
ErrorHandler |
getErrorHandler()
|
boolean |
getFeature(String name)
|
Object |
getProperty(String name)
|
String |
getProperty(String key,
String defaultValue)
|
String |
getStylesheetProperty(String name)
|
User |
getUser()
Get the current User. |
String |
hasXSLPi(Document doc)
Check if the document has an xml-stylesheet processing instruction that references an XSLT stylesheet. |
boolean |
isStylesheetApplied()
|
void |
parse(InputSource input)
|
void |
parse(String systemId)
|
void |
prepareStylesheets(DocumentImpl doc)
|
void |
reset()
Reset the class to its initial state. |
String |
serialize(DocumentImpl doc)
|
void |
serialize(DocumentImpl doc,
Writer writer)
Serialize a document to the supplied writer. |
void |
serialize(DocumentImpl doc,
Writer writer,
boolean prepareStylesheet)
|
String |
serialize(NodeProxy p)
Serialize a single NodeProxy. |
void |
serialize(NodeProxy p,
Writer out)
|
String |
serialize(NodeValue n)
|
void |
serialize(NodeValue n,
Writer out)
|
void |
setContentHandler(ContentHandler handler)
|
void |
setDTDHandler(DTDHandler handler)
Inherited from XMLReader. |
void |
setEntityResolver(EntityResolver resolver)
Sets the entityResolver attribute of the Serializer object |
void |
setErrorHandler(ErrorHandler handler)
Sets the errorHandler attribute of the Serializer object |
void |
setFeature(String name,
boolean value)
Sets the feature attribute of the Serializer object |
void |
setHttpContext(Serializer.HttpContext httpContext)
|
void |
setProperties(HashMap table)
|
void |
setProperties(Properties properties)
|
void |
setProperty(String prop,
Object value)
|
void |
setReceiver(Receiver receiver)
|
void |
setSAXHandlers(ContentHandler contentHandler,
LexicalHandler lexicalHandler)
Set the ContentHandler to be used during serialization. |
void |
setStylesheet(DocumentImpl doc,
String stylesheet)
Plug an XSL stylesheet into the processing pipeline. |
void |
setStylesheetParam(String param,
String value)
Set stylesheet parameter |
void |
setUser(User user)
Set the current User. |
void |
toReceiver(NodeProxy p,
boolean highlightMatches)
|
void |
toReceiver(NodeProxy p,
boolean highlightMatches,
boolean checkAttributes)
|
void |
toSAX(DocumentImpl doc)
|
void |
toSAX(NodeProxy p)
|
void |
toSAX(NodeValue n)
|
void |
toSAX(Sequence seq,
int start,
int count,
boolean wrap)
Serialize the items in the given sequence to SAX, starting with item start. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONFIGURATION_ELEMENT_NAME
public static final String ENABLE_XINCLUDE_ATTRIBUTE
public static final String PROPERTY_ENABLE_XINCLUDE
public static final String ENABLE_XSL_ATTRIBUTE
public static final String PROPERTY_ENABLE_XSL
public static final String INDENT_ATTRIBUTE
public static final String PROPERTY_INDENT
public static final String COMPRESS_OUTPUT_ATTRIBUTE
public static final String PROPERTY_COMPRESS_OUTPUT
public static final String ADD_EXIST_ID_ATTRIBUTE
public static final String PROPERTY_ADD_EXIST_ID
public static final String TAG_MATCHING_ELEMENTS_ATTRIBUTE
public static final String PROPERTY_TAG_MATCHING_ELEMENTS
public static final String TAG_MATCHING_ATTRIBUTES_ATTRIBUTE
public static final String PROPERTY_TAG_MATCHING_ATTRIBUTES
public static final String PROPERTY_SESSION_ID
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 int EXIST_ID_NONE
public static final int EXIST_ID_ELEMENT
public static final int EXIST_ID_ALL
public static final String GENERATE_DOC_EVENTS
public static final String ENCODING
| Constructor Detail |
|---|
public Serializer(DBBroker broker,
Configuration config)
| Method Detail |
|---|
public void setHttpContext(Serializer.HttpContext httpContext)
public void setProperties(Properties properties)
throws SAXNotRecognizedException,
SAXNotSupportedException
SAXNotRecognizedException
SAXNotSupportedException
public void setProperties(HashMap table)
throws SAXNotRecognizedException,
SAXNotSupportedException
SAXNotRecognizedException
SAXNotSupportedException
public void setProperty(String prop,
Object value)
throws SAXNotRecognizedException,
SAXNotSupportedException
setProperty in interface XMLReaderSAXNotRecognizedException
SAXNotSupportedException
public String getProperty(String key,
String defaultValue)
public boolean isStylesheetApplied()
public EntityResolver getEntityResolver()
getEntityResolver in interface XMLReaderpublic ErrorHandler getErrorHandler()
getErrorHandler in interface XMLReaderpublic void setUser(User user)
public User getUser()
public boolean getFeature(String name)
throws SAXNotRecognizedException,
SAXNotSupportedException
getFeature in interface XMLReaderSAXNotRecognizedException
SAXNotSupportedException
public Object getProperty(String name)
throws SAXNotRecognizedException,
SAXNotSupportedException
getProperty in interface XMLReaderSAXNotRecognizedException
SAXNotSupportedExceptionpublic String getStylesheetProperty(String name)
public void parse(InputSource input)
throws IOException,
SAXException
parse in interface XMLReaderIOException
SAXException
public void parse(String systemId)
throws IOException,
SAXException
parse in interface XMLReaderIOException
SAXExceptionpublic void reset()
public String serialize(DocumentImpl doc)
throws SAXException
SAXException
public void serialize(DocumentImpl doc,
Writer writer)
throws SAXException
SAXException
public void serialize(DocumentImpl doc,
Writer writer,
boolean prepareStylesheet)
throws SAXException
SAXException
public String serialize(NodeValue n)
throws SAXException
SAXException
public void serialize(NodeValue n,
Writer out)
throws SAXException
SAXException
public String serialize(NodeProxy p)
throws SAXException
p - Description of the Parameter
SAXException - Description of the Exception
public void serialize(NodeProxy p,
Writer out)
throws SAXException
SAXException
public void prepareStylesheets(DocumentImpl doc)
throws TransformerConfigurationException
TransformerConfigurationException
public void setSAXHandlers(ContentHandler contentHandler,
LexicalHandler lexicalHandler)
contentHandler - The new contentHandler valuepublic void setReceiver(Receiver receiver)
public void setContentHandler(ContentHandler handler)
setContentHandler in interface XMLReaderpublic ContentHandler getContentHandler()
getContentHandler in interface XMLReaderXMLReader.getContentHandler()public void setEntityResolver(EntityResolver resolver)
setEntityResolver in interface XMLReaderresolver - The new entityResolver valuepublic void setErrorHandler(ErrorHandler handler)
setErrorHandler in interface XMLReaderhandler - The new errorHandler value
public void setFeature(String name,
boolean value)
throws SAXNotRecognizedException,
SAXNotSupportedException
setFeature in interface XMLReadername - The new feature valuevalue - The new feature value
SAXNotRecognizedException - Description of the Exception
SAXNotSupportedException - Description of the Exception
public void setStylesheet(DocumentImpl doc,
String stylesheet)
throws TransformerConfigurationException
TransformerConfigurationException
public void setStylesheetParam(String param,
String value)
public void toSAX(DocumentImpl doc)
throws SAXException
SAXException
public void toSAX(NodeValue n)
throws SAXException
SAXException
public void toSAX(NodeProxy p)
throws SAXException
SAXException
public void toSAX(Sequence seq,
int start,
int count,
boolean wrap)
throws SAXException
Namespaces.EXIST_NS and has the following form:
<exist:result hits="sequence length" start="value of start" count="value of count">
seq - start - count - wrap -
SAXException
public void toReceiver(NodeProxy p,
boolean highlightMatches)
throws SAXException
SAXException
public void toReceiver(NodeProxy p,
boolean highlightMatches,
boolean checkAttributes)
throws SAXException
SAXExceptionpublic void setDTDHandler(DTDHandler handler)
setDTDHandler in interface XMLReaderXMLReader.setDTDHandler(org.xml.sax.DTDHandler)public DTDHandler getDTDHandler()
getDTDHandler in interface XMLReaderXMLReader.getDTDHandler()public String hasXSLPi(Document doc)
doc -
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||