java.lang.Object
org.apache.wicket.markup.parser.XmlPullParser
- All Implemented Interfaces:
IXmlPullParser
A fairly shallow markup pull parser which parses a markup string of a given type of markup (for
example, html, xml, vxml or wml) into ComponentTag and RawMarkup tokens.
- Author:
- Jonathan Locke, Juergen Donnerstag
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.wicket.markup.parser.IXmlPullParser
IXmlPullParser.HttpTagType
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal CharSequence
Gets the <!final XmlTag
final String
Return the encoding applied while reading the markup resource.final CharSequence
getInput
(int fromPos, int toPos) Wicket dissects the markup into Wicket relevant tags and raw markup, which is not further analyzed by Wicket.final CharSequence
getInputFromPositionMarker
(int toPos) Wicket dissects the markup into Wicket relevant tags and raw markup, which is not further analyzed by Wicket.final CharSequence
next()
Move to the next XML elementfinal XmlTag
nextTag()
void
parse
(InputStream in) Reads and parses markup from an input stream, using UTF-8 encoding by default when not specified in XML declaration.void
parse
(InputStream inputStream, String encoding) Reads and parses markup from an input stream.void
parse
(CharSequence string) Parse the given string.final void
Set the position marker of the markup at the current position.final void
setPositionMarker
(int pos) Set the position marker of the markupprotected void
specialTagHandling
(String tagText, int openBracketIndex, int closeBracketIndex) Handle special tags like <!toString()
-
Field Details
-
STYLE
- See Also:
-
SCRIPT
- See Also:
-
-
Constructor Details
-
XmlPullParser
public XmlPullParser()Construct.
-
-
Method Details
-
getEncoding
Description copied from interface:IXmlPullParser
Return the encoding applied while reading the markup resource. The encoding is determined by analyzing the <?xml version=".." encoding=".." ?> tag.- Specified by:
getEncoding
in interfaceIXmlPullParser
- Returns:
- if null, JVM defaults have been used.
-
getDoctype
Description copied from interface:IXmlPullParser
Gets the <!DOCTYPE ...> tag if found in the markup- Specified by:
getDoctype
in interfaceIXmlPullParser
- Returns:
- Null, if not found
-
getInputFromPositionMarker
Description copied from interface:IXmlPullParser
Wicket dissects the markup into Wicket relevant tags and raw markup, which is not further analyzed by Wicket. The method getInputFromPositionMarker() is used to access the raw markup.- Specified by:
getInputFromPositionMarker
in interfaceIXmlPullParser
- Parameters:
toPos
- To position- Returns:
- The raw markup in between the position marker and toPos
-
getInput
Description copied from interface:IXmlPullParser
Wicket dissects the markup into Wicket relevant tags and raw markup, which is not further analyzed by Wicket. The getInputSubsequence() method is used to access the raw markup.- Specified by:
getInput
in interfaceIXmlPullParser
- Parameters:
fromPos
- From positiontoPos
- To position- Returns:
- The raw markup in between fromPos and toPos
-
next
Description copied from interface:IXmlPullParser
Move to the next XML element- Specified by:
next
in interfaceIXmlPullParser
- Returns:
- XXX
- Throws:
ParseException
-
specialTagHandling
protected void specialTagHandling(String tagText, int openBracketIndex, int closeBracketIndex) throws ParseException Handle special tags like <!-- --> or <![CDATA[..]]> or <?xml>- Parameters:
tagText
-openBracketIndex
-closeBracketIndex
-- Throws:
ParseException
-
getElement
- Specified by:
getElement
in interfaceIXmlPullParser
- Returns:
- MarkupElement
-
getString
- Specified by:
getString
in interfaceIXmlPullParser
- Returns:
- The xml string from the last element
-
nextTag
- Returns:
- The next XML tag
- Throws:
ParseException
-
parse
Parse the given string.Note: xml character encoding is NOT applied. It is assumed the input provided does have the correct encoding already.
- Specified by:
parse
in interfaceIXmlPullParser
- Parameters:
string
- The input string- Throws:
IOException
- Error while reading the resource
-
parse
Reads and parses markup from an input stream, using UTF-8 encoding by default when not specified in XML declaration.- Specified by:
parse
in interfaceIXmlPullParser
- Parameters:
in
- The input stream to read and parse- Throws:
IOException
- See Also:
-
parse
Reads and parses markup from an input stream.Note: The input is closed after parsing.
- Specified by:
parse
in interfaceIXmlPullParser
- Parameters:
inputStream
- The input stream to read and parseencoding
- The default character encoding of the input- Throws:
IOException
-
setPositionMarker
Description copied from interface:IXmlPullParser
Set the position marker of the markup at the current position.- Specified by:
setPositionMarker
in interfaceIXmlPullParser
-
setPositionMarker
Description copied from interface:IXmlPullParser
Set the position marker of the markup- Specified by:
setPositionMarker
in interfaceIXmlPullParser
-
toString
-