|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.maven.doxia.parser.AbstractParser
org.apache.maven.doxia.parser.AbstractXmlParser
public abstract class AbstractXmlParser
An abstract class that defines some convenience methods for XML parsers.
| Nested Class Summary | |
|---|---|
static class |
AbstractXmlParser.CachedFileEntityResolver
Implementation of the callback mechanism EntityResolver. |
| Field Summary |
|---|
| Fields inherited from interface org.apache.maven.doxia.markup.XmlMarkup |
|---|
BANG, CDATA, DOCTYPE_START, ENTITY_START, XML_NAMESPACE |
| Fields inherited from interface org.apache.maven.doxia.markup.Markup |
|---|
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STAR |
| Fields inherited from interface org.apache.maven.doxia.parser.Parser |
|---|
ROLE, TXT_TYPE, UNKNOWN_TYPE, XML_TYPE |
| Constructor Summary | |
|---|---|
AbstractXmlParser()
|
|
| Method Summary | |
|---|---|
protected SinkEventAttributeSet |
getAttributesFromParser(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
Converts the attributes of the current start tag of the given parser to a SinkEventAttributeSet. |
protected java.util.Map |
getLocalEntities()
Return the defined entities in a local doctype, i.e.: <! |
protected java.lang.String |
getText(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
getText |
int |
getType()
The parser type value could be Parser.UNKNOWN_TYPE, Parser.TXT_TYPE or
Parser.XML_TYPE. |
protected abstract void |
handleCdsect(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
Handles CDATA sections. |
protected abstract void |
handleComment(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
Handles comments. |
protected abstract void |
handleEndTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
Goes through the possible end tags. |
protected abstract void |
handleEntity(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
Handles entities. |
protected abstract void |
handleStartTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
Goes through the possible start tags. |
protected abstract void |
handleText(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
Handles text events. |
protected boolean |
isCollapsibleWhitespace()
isCollapsibleWhitespace |
protected boolean |
isIgnorableWhitespace()
isIgnorableWhitespace |
protected boolean |
isTrimmableWhitespace()
isTrimmableWhitespace |
boolean |
isValidate()
isValidate |
void |
parse(java.io.Reader source,
Sink sink)
Parses the given source model and emits Doxia events into the given sink. |
void |
parse(java.lang.String string,
Sink sink)
Convenience method to parse an arbitrary string and emit events into the given sink. Convenience method to parse an arbitrary string and emit any xml events into the given sink. |
protected void |
setCollapsibleWhitespace(boolean collapsible)
Specify that text will be collapse i.e.: Text Text is equivalent to Text Text |
protected void |
setIgnorableWhitespace(boolean ignorable)
Specify that whitespace will be ignore i.e.: <tr> <td/> </tr> is equivalent to <tr><td/></tr> |
protected void |
setTrimmableWhitespace(boolean trimmable)
Specify that text will be collapse i.e.: <p> Text </p> is equivalent to <p>Text</p> |
void |
setValidate(boolean validate)
Specify a flag to validate or not the XML content. |
| Methods inherited from class org.apache.maven.doxia.parser.AbstractParser |
|---|
enableLogging, executeMacro, getBasedir, getLog, getMacroManager, isSecondParsing, setSecondParsing |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractXmlParser()
| Method Detail |
|---|
public void parse(java.io.Reader source,
Sink sink)
throws ParseException
parse in interface Parsersource - not null reader that provides the source document.
You could use newReader methods from ReaderFactory.sink - A sink that consumes the Doxia events.
ParseException - if the model could not be parsed.
public void parse(java.lang.String string,
Sink sink)
throws ParseException
parse in class AbstractParserstring - A string that provides the source input.sink - A sink that consumes the Doxia events.
ParseException - if the string could not be parsed.public final int getType()
Parser.UNKNOWN_TYPE, Parser.TXT_TYPE or
Parser.XML_TYPE.
getType in interface ParsergetType in class AbstractParserprotected SinkEventAttributeSet getAttributesFromParser(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
parser - A parser, not null.
protected abstract void handleStartTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
MacroExecutionException
parser - A parser, not null.sink - the sink to receive the events.
org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the model
MacroExecutionException - if there's a problem executing a macro
protected abstract void handleEndTag(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException,
MacroExecutionException
parser - A parser, not null.sink - the sink to receive the events.
org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the model
MacroExecutionException - if there's a problem executing a macro
protected abstract void handleText(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
parser - A parser, not null.sink - the sink to receive the events.
org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the model
protected abstract void handleCdsect(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
parser - A parser, not null.sink - the sink to receive the events.
org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the model
protected abstract void handleComment(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
parser - A parser, not null.sink - the sink to receive the events.
org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the model
protected abstract void handleEntity(org.codehaus.plexus.util.xml.pull.XmlPullParser parser,
Sink sink)
throws org.codehaus.plexus.util.xml.pull.XmlPullParserException
parser - A parser, not null.sink - the sink to receive the events.
org.codehaus.plexus.util.xml.pull.XmlPullParserException - if there's a problem parsing the modelprotected boolean isIgnorableWhitespace()
isIgnorableWhitespace
true if whitespace will be ignored, false otherwise.setIgnorableWhitespace(boolean)protected void setIgnorableWhitespace(boolean ignorable)
<tr> <td/> </tr>is equivalent to
<tr><td/></tr>
ignorable - true to ignore whitespace, false otherwise.protected boolean isCollapsibleWhitespace()
isCollapsibleWhitespace
true if text will collapse, false otherwise.setCollapsibleWhitespace(boolean)protected void setCollapsibleWhitespace(boolean collapsible)
Text Textis equivalent to
Text Text
collapsible - true to allow collapsible text, false otherwise.protected boolean isTrimmableWhitespace()
isTrimmableWhitespace
true if text will be trim, false otherwise.setTrimmableWhitespace(boolean)protected void setTrimmableWhitespace(boolean trimmable)
<p> Text </p>is equivalent to
<p>Text</p>
trimmable - true to allow trimmable text, false otherwise.protected java.lang.String getText(org.codehaus.plexus.util.xml.pull.XmlPullParser parser)
getText
parser - A parser, not null.
XmlPullParser.getText() taking care of trimmable or collapsible configuration.XmlPullParser.getText(),
isCollapsibleWhitespace(),
isTrimmableWhitespace()protected java.util.Map getLocalEntities()
<!DOCTYPE foo [ <!ENTITY bar "Š"> <!ENTITY bar1 "š"> ]>
public boolean isValidate()
isValidate
true if XML content will be validate, false otherwise.public void setValidate(boolean validate)
validate - the validate to setparse(Reader, Sink)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||