|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.exist.storage.serializers.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
| Field Summary | |
static java.lang.String |
ENCODING
|
static java.lang.String |
EXIST_NS
|
static java.lang.String |
GENERATE_DOC_EVENTS
|
static int |
TAG_ATTRIBUTE_MATCHES
|
static int |
TAG_BOTH
|
static int |
TAG_ELEMENT_MATCHES
|
static int |
TAG_NONE
|
| Constructor Summary | |
Serializer(DBBroker broker,
Configuration config)
|
|
| Method Summary | |
org.xml.sax.ContentHandler |
getContentHandler()
Required by interface XMLReader. |
org.xml.sax.DTDHandler |
getDTDHandler()
Inherited from XMLReader. |
org.xml.sax.EntityResolver |
getEntityResolver()
Return my internal EntityResolver |
org.xml.sax.ErrorHandler |
getErrorHandler()
|
boolean |
getFeature(java.lang.String name)
|
java.lang.Object |
getProperty(java.lang.String name)
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
|
java.lang.String |
getStylesheetProperty(java.lang.String name)
|
User |
getUser()
Get the current User. |
java.lang.String |
hasXSLPi(org.w3c.dom.Document doc)
Check if the document has an xml-stylesheet processing instruction that references an XSLT stylesheet. |
boolean |
isStylesheetApplied()
|
void |
parse(org.xml.sax.InputSource input)
|
void |
parse(java.lang.String systemId)
|
void |
prepareStylesheets(DocumentImpl doc)
|
void |
reset()
Reset the class to its initial state. |
java.lang.String |
serialize(DocumentImpl doc)
|
void |
serialize(DocumentImpl doc,
java.io.Writer writer)
Serialize a document to the supplied writer. |
void |
serialize(DocumentImpl doc,
java.io.Writer writer,
boolean prepareStylesheet)
|
java.lang.String |
serialize(NodeProxy p)
Serialize a single NodeProxy. |
java.lang.String |
serialize(NodeValue n)
|
void |
setContentHandler(org.xml.sax.ContentHandler handler)
|
void |
setDTDHandler(org.xml.sax.DTDHandler handler)
Inherited from XMLReader. |
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 |
setProperties(java.util.Hashtable table)
|
void |
setProperties(java.util.Properties properties)
|
void |
setProperty(java.lang.String prop,
java.lang.Object value)
|
void |
setReceiver(Receiver receiver)
|
void |
setSAXHandlers(org.xml.sax.ContentHandler contentHandler,
org.xml.sax.ext.LexicalHandler lexicalHandler)
Set the ContentHandler to be used during serialization. |
void |
setStylesheet(DocumentImpl doc,
java.lang.String stylesheet)
Plug an XSL stylesheet into the processing pipeline. |
void |
setStylesheet(java.lang.String stylesheet)
|
void |
setStylesheetParam(java.lang.String param,
java.lang.String value)
Set stylesheet parameter |
void |
setUser(User user)
Set the current User. |
void |
toReceiver(NodeProxy p)
|
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 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 GENERATE_DOC_EVENTS
public static final java.lang.String ENCODING
| Constructor Detail |
public Serializer(DBBroker broker,
Configuration config)
| Method Detail |
public void setProperties(java.util.Properties properties)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public void setProperties(java.util.Hashtable table)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public void setProperty(java.lang.String prop,
java.lang.Object value)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
setProperty in interface org.xml.sax.XMLReaderorg.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
public boolean isStylesheetApplied()
public org.xml.sax.EntityResolver getEntityResolver()
getEntityResolver in interface org.xml.sax.XMLReaderpublic org.xml.sax.ErrorHandler getErrorHandler()
getErrorHandler in interface org.xml.sax.XMLReaderpublic 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.XMLReaderorg.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
public java.lang.Object getProperty(java.lang.String name)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
getProperty in interface org.xml.sax.XMLReaderorg.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedExceptionpublic java.lang.String getStylesheetProperty(java.lang.String name)
public void parse(org.xml.sax.InputSource input)
throws java.io.IOException,
org.xml.sax.SAXException
parse in interface org.xml.sax.XMLReaderjava.io.IOException
org.xml.sax.SAXException
public void parse(java.lang.String systemId)
throws java.io.IOException,
org.xml.sax.SAXException
parse in interface org.xml.sax.XMLReaderjava.io.IOException
org.xml.sax.SAXExceptionpublic void reset()
public java.lang.String serialize(DocumentImpl doc)
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void serialize(DocumentImpl doc,
java.io.Writer writer)
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void serialize(DocumentImpl doc,
java.io.Writer writer,
boolean prepareStylesheet)
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public java.lang.String serialize(NodeValue n)
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public java.lang.String serialize(NodeProxy p)
throws org.xml.sax.SAXException
p - Description of the Parameter
org.xml.sax.SAXException - Description of the Exceptionpublic void prepareStylesheets(DocumentImpl doc)
public void setSAXHandlers(org.xml.sax.ContentHandler contentHandler,
org.xml.sax.ext.LexicalHandler lexicalHandler)
contentHandler - The new contentHandler valuepublic void setReceiver(Receiver receiver)
public void setContentHandler(org.xml.sax.ContentHandler handler)
setContentHandler in interface org.xml.sax.XMLReaderpublic org.xml.sax.ContentHandler getContentHandler()
getContentHandler in interface org.xml.sax.XMLReaderXMLReader.getContentHandler()public void setEntityResolver(org.xml.sax.EntityResolver resolver)
setEntityResolver in interface org.xml.sax.XMLReaderresolver - The new entityResolver valuepublic void setErrorHandler(org.xml.sax.ErrorHandler handler)
setErrorHandler in interface org.xml.sax.XMLReaderhandler - The new errorHandler value
public void setFeature(java.lang.String name,
boolean value)
throws org.xml.sax.SAXNotRecognizedException,
org.xml.sax.SAXNotSupportedException
setFeature in interface org.xml.sax.XMLReadername - 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 setStylesheet(java.lang.String stylesheet)
public void setStylesheet(DocumentImpl doc,
java.lang.String stylesheet)
public void setStylesheetParam(java.lang.String param,
java.lang.String value)
public void toSAX(DocumentImpl doc)
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void toSAX(NodeValue n)
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void toSAX(NodeProxy p)
throws org.xml.sax.SAXException
org.xml.sax.SAXException
public void toSAX(Sequence seq,
int start,
int count,
boolean wrap)
throws org.xml.sax.SAXException
EXIST_NS and has the following form:
<exist:result hits="sequence length" start="value of start" count="value of count">
seq - start - count - wrap -
org.xml.sax.SAXException
public void toReceiver(NodeProxy p)
throws org.xml.sax.SAXException
org.xml.sax.SAXExceptionpublic void setDTDHandler(org.xml.sax.DTDHandler handler)
setDTDHandler in interface org.xml.sax.XMLReaderXMLReader.setDTDHandler(org.xml.sax.DTDHandler)public org.xml.sax.DTDHandler getDTDHandler()
getDTDHandler in interface org.xml.sax.XMLReaderXMLReader.getDTDHandler()public java.lang.String hasXSLPi(org.w3c.dom.Document doc)
doc -
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||