Package org.restlet.ext.atom.internal
Class FeedContentReader
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.restlet.ext.atom.FeedReader
-
- org.restlet.ext.atom.internal.FeedContentReader
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler,org.xml.sax.DTDHandler,org.xml.sax.EntityResolver,org.xml.sax.ErrorHandler
public class FeedContentReader extends FeedReader
Content reader for feeds.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classFeedContentReader.State
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringBuildercontentBufferBuffer for the current text content of the current tag.private intcontentDepthMark the Content depth.private MediaTypecontentTypeThe media type of the Content (for inline cases).private CategorycurrentCategoryThe currently parsed Category.private ContentcurrentContentThe currently parsed Content.private XmlWritercurrentContentWriterThe currently parsed XML content writer.private java.util.DatecurrentDateThe currently date parsed from the current text content.private EntrycurrentEntryThe currently parsed Entry.private FeedcurrentFeedThe currently parsed Feed.private LinkcurrentLinkThe currently parsed Link.private PersoncurrentPersonThe currently parsed Person.private TextcurrentTextThe currently parsed Text.private java.util.Map<java.lang.String,java.lang.String>prefixMappingsThe current list of prefix mappings.private FeedContentReader.StatestateThe current state.
-
Constructor Summary
Constructors Constructor Description FeedContentReader(Feed feed)Constructor.FeedContentReader(Feed feed, FeedReader extraFeedReader)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)voidendDocument()voidendElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)voidendPrefixMapping(java.lang.String prefix)private MediaTypegetMediaType(java.lang.String type)Returns a media type from an Atom type attribute.private voidinitiateInlineMixedContent()Initiates the parsing of a mixed content part of the current document.voidstartDocument()voidstartElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)voidstartPrefixMapping(java.lang.String prefix, java.lang.String uri)voidstartTextElement(org.xml.sax.Attributes attrs)Receives notification of the beginning of a text element.-
Methods inherited from class org.restlet.ext.atom.FeedReader
endContent, endEntry, endFeed, endLink, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startContent, startEntry, startFeed, startLink, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
contentBuffer
private java.lang.StringBuilder contentBuffer
Buffer for the current text content of the current tag.
-
contentDepth
private int contentDepth
Mark the Content depth.
-
contentType
private MediaType contentType
The media type of the Content (for inline cases).
-
currentCategory
private Category currentCategory
The currently parsed Category.
-
currentContent
private Content currentContent
The currently parsed Content.
-
currentContentWriter
private XmlWriter currentContentWriter
The currently parsed XML content writer.
-
currentDate
private java.util.Date currentDate
The currently date parsed from the current text content.
-
currentEntry
private Entry currentEntry
The currently parsed Entry.
-
currentFeed
private final Feed currentFeed
The currently parsed Feed.
-
currentLink
private Link currentLink
The currently parsed Link.
-
currentPerson
private Person currentPerson
The currently parsed Person.
-
currentText
private Text currentText
The currently parsed Text.
-
prefixMappings
private java.util.Map<java.lang.String,java.lang.String> prefixMappings
The current list of prefix mappings.
-
state
private FeedContentReader.State state
The current state.
-
-
Constructor Detail
-
FeedContentReader
public FeedContentReader(Feed feed)
Constructor.- Parameters:
feed- The feed object to update during the parsing.
-
FeedContentReader
public FeedContentReader(Feed feed, FeedReader extraFeedReader)
Constructor.- Parameters:
feed- The feed object to update during the parsing.extraFeedReader- Custom handler of all events.
-
-
Method Detail
-
characters
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException- Specified by:
charactersin interfaceorg.xml.sax.ContentHandler- Overrides:
charactersin classFeedReader- Throws:
org.xml.sax.SAXException
-
endDocument
public void endDocument() throws org.xml.sax.SAXException- Specified by:
endDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
endDocumentin classFeedReader- Throws:
org.xml.sax.SAXException
-
endElement
public void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException- Specified by:
endElementin interfaceorg.xml.sax.ContentHandler- Overrides:
endElementin classFeedReader- Throws:
org.xml.sax.SAXException
-
endPrefixMapping
public void endPrefixMapping(java.lang.String prefix) throws org.xml.sax.SAXException- Specified by:
endPrefixMappingin interfaceorg.xml.sax.ContentHandler- Overrides:
endPrefixMappingin classFeedReader- Throws:
org.xml.sax.SAXException
-
getMediaType
private MediaType getMediaType(java.lang.String type)
Returns a media type from an Atom type attribute.- Parameters:
type- The Atom type attribute.- Returns:
- The media type.
-
initiateInlineMixedContent
private void initiateInlineMixedContent()
Initiates the parsing of a mixed content part of the current document.
-
startDocument
public void startDocument() throws org.xml.sax.SAXException- Specified by:
startDocumentin interfaceorg.xml.sax.ContentHandler- Overrides:
startDocumentin classFeedReader- Throws:
org.xml.sax.SAXException
-
startElement
public void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXException- Specified by:
startElementin interfaceorg.xml.sax.ContentHandler- Overrides:
startElementin classFeedReader- Throws:
org.xml.sax.SAXException
-
startPrefixMapping
public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws org.xml.sax.SAXException- Specified by:
startPrefixMappingin interfaceorg.xml.sax.ContentHandler- Overrides:
startPrefixMappingin classFeedReader- Throws:
org.xml.sax.SAXException
-
startTextElement
public void startTextElement(org.xml.sax.Attributes attrs)
Receives notification of the beginning of a text element.- Parameters:
attrs- The attributes attached to the element.
-
-