|
Copyright (c) 2000-2002 ChurchillObjects.com | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--churchillobjects.rss4j.generator.RssGenerator
A base and factory class for RSS generator objects. From a version number, will construct an appropriate implementation and generate the RSS document.
Field Summary | |
protected int |
channelBuildDate
|
protected int |
channelCopyrightMax
|
protected int |
channelDescriptionMax
|
protected int |
channelDocsMax
|
protected int |
channelLinkMax
|
protected int |
channelManagingEditorMax
|
protected int |
channelPubDate
|
protected int |
channelTitleMax
|
protected int |
channelWebmasterMax
|
protected org.w3c.dom.Document |
doc
The XML document, used as it is being built. |
protected org.w3c.dom.DOMImplementation |
domImpl
The DOM implementation used by the XML toolkit (user-supplied, but best to use Apache's Xerces). |
protected org.apache.xml.serialize.OutputFormat |
format
An XML formatter object for the document when it is serialized. |
protected int |
imageDescriptionMax
|
protected int |
imageLinkMax
|
protected int |
imageTitleMax
|
protected int |
imageUrlMax
|
protected int |
itemDescriptionMax
|
protected int |
itemLinkMax
|
protected int |
itemTitleMax
|
protected java.io.OutputStream |
outputStream
|
protected java.io.Writer |
outputWriter
|
protected org.w3c.dom.Element |
rootElement
|
protected int |
textInputDescriptionMax
|
protected int |
textInputLinkMax
|
protected int |
textInputNameMax
|
protected int |
textInputTitleMax
|
private boolean |
truncateText
|
Constructor Summary | |
(package private) |
RssGenerator()
Constructor. |
Method Summary | |
protected org.w3c.dom.Element |
add(org.w3c.dom.Element baseElement,
java.lang.String nodeName,
java.lang.String textValue)
Convenience method that adds a new node to an existing XML element with the specified value. |
protected abstract void |
createRssDocument(churchillobjects.rss4j.RssDocument data)
Subclass implementation for creating the DOM from the specified RSS document object model. |
protected java.lang.String |
embedHtml(java.lang.String s)
For fields that may have HTML embedded in the code, adds a CDATA wrapper for the text value so that XML validators will not blow up. |
protected abstract void |
finishDocument()
|
static java.lang.String |
generateRss(churchillobjects.rss4j.RssDocument document)
Creates an appropriate instance of RssGenerator with a StringWriter and generates the RSS into the writer, then returns the XML as a string. |
static void |
generateRss(churchillobjects.rss4j.RssDocument document,
java.io.File file)
Creates an appropriate instance of RssGenerator and has it write the RSS code to the specified file object. |
static void |
generateRss(churchillobjects.rss4j.RssDocument document,
java.io.OutputStream output)
Creates an appropriate instance of RssGenerator and has it write the RSS code to the specified output stream. |
static void |
generateRss(churchillobjects.rss4j.RssDocument document,
java.io.Writer output)
Creates an appropriate instance of RssGenerator and has it write the RSS code to the specified output writer. |
private static churchillobjects.rss4j.generator.RssGenerator |
getGenerator(churchillobjects.rss4j.RssDocument document)
Returns the appropriate generator for the specified RSS document object. |
protected abstract void |
handleChannel(churchillobjects.rss4j.RssChannel channel)
|
boolean |
isTruncateText()
Inidcates that truncation is on or off, whereby certain text (titles, descriptions, etc. |
protected abstract void |
setMaxLengths()
Implemented by subclasses. |
void |
setTruncateText(boolean b)
Set this accessor to TRUE if truncation of text is desired. |
protected java.lang.String |
truncate(java.lang.String s,
int length)
|
protected void |
validateUri(java.lang.String s)
For fields that must have valid URIs, checks to see that the field contains one of the four valid URI prefixes (http, https, ftp or mailto). |
protected void |
validateValueOptional(java.lang.String value,
java.lang.String name,
int maxLength)
Overloaded version of validateValueOptional, for when there is no minimum length for the field (1 will be used for minimum length). |
protected void |
validateValueOptional(java.lang.String value,
java.lang.String name,
int minLength,
int maxLength)
Validates a value for a field that is not required, checking its minimum and maximum lengths. |
protected void |
validateValueRequired(java.lang.String value,
java.lang.String name,
int maxLength)
Overloaded version of validateValueRequired, for when there is no minimum length for the field (1 will be used for minimum length). |
protected void |
validateValueRequired(java.lang.String value,
java.lang.String name,
int minLength,
int maxLength)
Validates a value for a field that is required, checking its minimum and maximum lengths. |
private void |
writeRssDocument(churchillobjects.rss4j.RssDocument data)
Serializes the completed DOM structure to the source given by the client code. |
private void |
writeRssDocument(churchillobjects.rss4j.RssDocument data,
java.io.File file)
Overloaded write method for a Java File object. |
private void |
writeRssDocument(churchillobjects.rss4j.RssDocument data,
java.io.OutputStream output)
Overloaded write method fo a Java IO output stream. |
private void |
writeRssDocument(churchillobjects.rss4j.RssDocument data,
java.io.Writer output)
Overloaded write method for a Java IO writer object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.w3c.dom.DOMImplementation domImpl
protected org.apache.xml.serialize.OutputFormat format
protected org.w3c.dom.Document doc
protected java.io.Writer outputWriter
protected java.io.OutputStream outputStream
protected org.w3c.dom.Element rootElement
private boolean truncateText
protected int channelTitleMax
protected int channelDescriptionMax
protected int channelLinkMax
protected int channelPubDate
protected int channelBuildDate
protected int channelManagingEditorMax
protected int channelWebmasterMax
protected int channelCopyrightMax
protected int channelDocsMax
protected int imageTitleMax
protected int imageUrlMax
protected int imageLinkMax
protected int imageDescriptionMax
protected int itemTitleMax
protected int itemLinkMax
protected int itemDescriptionMax
protected int textInputTitleMax
protected int textInputDescriptionMax
protected int textInputNameMax
protected int textInputLinkMax
Constructor Detail |
RssGenerator() throws RssGenerationException
Method Detail |
public static java.lang.String generateRss(churchillobjects.rss4j.RssDocument document) throws RssGenerationException
document
-
RssGenerationException
public static void generateRss(churchillobjects.rss4j.RssDocument document, java.io.OutputStream output) throws RssGenerationException
document
- output
-
RssGenerationException
public static void generateRss(churchillobjects.rss4j.RssDocument document, java.io.File file) throws RssGenerationException
document
- file
-
RssGenerationException
public static void generateRss(churchillobjects.rss4j.RssDocument document, java.io.Writer output) throws RssGenerationException
document
- output
-
RssGenerationException
private static churchillobjects.rss4j.generator.RssGenerator getGenerator(churchillobjects.rss4j.RssDocument document) throws RssGenerationException
document
-
RssGenerationException
protected abstract void setMaxLengths()
protected abstract void handleChannel(churchillobjects.rss4j.RssChannel channel) throws RssGenerationException
RssGenerationException
protected abstract void finishDocument() throws RssGenerationException
RssGenerationException
private void writeRssDocument(churchillobjects.rss4j.RssDocument data) throws RssGenerationException
data
-
RssGenerationException
protected abstract void createRssDocument(churchillobjects.rss4j.RssDocument data) throws RssGenerationException
data
-
RssGenerationException
private void writeRssDocument(churchillobjects.rss4j.RssDocument data, java.io.OutputStream output) throws RssGenerationException
data
- output
-
RssGenerationException
private void writeRssDocument(churchillobjects.rss4j.RssDocument data, java.io.File file) throws RssGenerationException
data
- file
-
RssGenerationException
private void writeRssDocument(churchillobjects.rss4j.RssDocument data, java.io.Writer output) throws RssGenerationException
data
- output
-
RssGenerationException
protected org.w3c.dom.Element add(org.w3c.dom.Element baseElement, java.lang.String nodeName, java.lang.String textValue)
baseElement
- nodeName
- textValue
-
public void setTruncateText(boolean b)
b
- Truncate too-long text during RSS generation, if the standard warrants it.public boolean isTruncateText()
protected java.lang.String truncate(java.lang.String s, int length) throws RssGenerationException
s
- The string value to truncate. If null, then nothing is done.length
- The number of characters to truncate to. If zero, then there is
no limit on the length of the element.
RssGenerationException
protected void validateValueRequired(java.lang.String value, java.lang.String name, int minLength, int maxLength) throws RssGenerationException
value
- name
- minLength
- maxLength
-
RssGenerationException
protected void validateValueRequired(java.lang.String value, java.lang.String name, int maxLength) throws RssGenerationException
value
- name
- maxLength
-
RssGenerationException
protected void validateValueOptional(java.lang.String value, java.lang.String name, int minLength, int maxLength) throws RssGenerationException
value
- name
- minLength
- maxLength
-
RssGenerationException
protected void validateValueOptional(java.lang.String value, java.lang.String name, int maxLength) throws RssGenerationException
value
- name
- maxLength
-
RssGenerationException
protected java.lang.String embedHtml(java.lang.String s)
s
- The text to be evaluated
protected void validateUri(java.lang.String s) throws RssGenerationException
s
- The URI value to evaluate
RssGenerationException
- When the validation fails
|
Copyright (c) 2000-2002 ChurchillObjects.com | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |