@Singleton @Named public class ContentParserXml extends AbstractContentParser
ContentParser interface for XML
documents (content with the mimetype "text/xml"). | Modifier and Type | Field and Description |
|---|---|
static String |
KEY_EXTENSION
The default extension.
|
static String |
KEY_MIMETYPE
The mimetype.
|
private XmlUtil |
xmlUtil |
VARIABLE_NAME_CREATOR, VARIABLE_NAME_KEYWORDS, VARIABLE_NAME_LANGUAGE, VARIABLE_NAME_TEXT, VARIABLE_NAME_TITLE| Constructor and Description |
|---|
ContentParserXml()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doInitialize()
This method performs the actual
initialization. |
String[] |
getAlternativeKeyArray()
|
String |
getExtension()
This method gets the default filename extension excluding the dot (e.g.
|
String |
getMimetype()
This method gets the default mimetype (e.g.
|
String[] |
getSecondaryKeyArray()
This method gets the
secondary keys as array. |
protected XmlUtil |
getXmlUtil() |
void |
parse(BufferedReader bufferedReader,
ContentParserOptions options,
MutableGenericContext context,
StringBuilder textBuffer)
This method parses the content of the given
bufferedReader and
appends the textual content to the textBuffer. |
void |
parse(InputStream inputStream,
long filesize,
ContentParserOptions options,
MutableGenericContext context) |
void |
setXmlUtil(XmlUtil xmlUtil) |
getPrimaryKeys, getSecondaryKeys, parse, parse, setGenericContextFactorycreateLogger, getLoggerdoInitialized, getInitializationState, initializepublic static final String KEY_MIMETYPE
public static final String KEY_EXTENSION
private XmlUtil xmlUtil
getXmlUtil()protected void doInitialize()
initialization. It is called when AbstractComponent.initialize() is
invoked for the first time. super.AbstractComponent.doInitialize().doInitialize in class AbstractContentParserprotected XmlUtil getXmlUtil()
@Inject public void setXmlUtil(XmlUtil xmlUtil)
xmlUtil - is the xmlUtil to setpublic String getExtension()
ContentParser.null if this is the
generic parser.public String getMimetype()
ContentParser.null if this is the
generic parser.public String[] getAlternativeKeyArray()
getAlternativeKeyArray in class AbstractContentParserAbstractContentParser.getPrimaryKeys()public String[] getSecondaryKeyArray()
secondary keys as array.
This is just a convenience to make it easier for the implementors of
individual parsers not to deal with creating a Set and make it
unmodifiable.getSecondaryKeyArray in class AbstractContentParserAbstractContentParser.getPrimaryKeys()public void parse(InputStream inputStream, long filesize, ContentParserOptions options, MutableGenericContext context) throws Exception
parse in class AbstractContentParserinputStream - is the fresh input stream of the content to parse.filesize - is the size (content-length) of the content to parse in
bytes or 0 if NOT available (unknown). If available,
the parser may use this value for optimized allocations.options - are the ContentParserOptions.context - is the MutableGenericContext where the extracted
metadata from the parsed inputStream will be
added to.Exception - if the operation fails for arbitrary reasons.ContentParser.parse(InputStream, long)public void parse(BufferedReader bufferedReader, ContentParserOptions options, MutableGenericContext context, StringBuilder textBuffer) throws Exception
bufferedReader and
appends the textual content to the textBuffer. Additional
metadata can directly be set in the given properties.bufferedReader - is where to read the content from.options - are the ContentParserOptions.context - is where the metadata is collected.textBuffer - is the buffer where the textual content should be
appended to.Exception - if something goes wrong.Copyright © 2001–2016 mmm-Team. All rights reserved.