java.lang.Object
org.apache.wicket.markup.AbstractMarkupParser
- Direct Known Subclasses:
MarkupParser
This is a base MarkupParser specifically for (X)HTML. It makes use of a streaming XML parser to
read the markup and IMarkupFilters to remove comments, identify Wicket relevant tags, apply html
specific treatments etc.. Please see WicketMarkupParser for a parser preconfigured for Wicket.
The result will be an Markup object, which is basically a list, containing Wicket relevant tags and RawMarkup.
- Author:
- Jonathan Locke, Juergen Donnerstag
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Pattern
Opening a conditional comment section, which is NOT treated as a comment section -
Constructor Summary
ConstructorDescriptionAbstractMarkupParser
(String markup) Constructor.AbstractMarkupParser
(MarkupResourceStream resource) Constructor.AbstractMarkupParser
(IXmlPullParser xmlParser, MarkupResourceStream resource) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
compressWhitespace
(String rawMarkup) Remove whitespace from the raw markupprotected MarkupResourceStream
Applications which subclass initFilterChain() might also wish to access the markup resource stream.protected CharSequence
handleRawText
(String rawMarkup) protected abstract List<IMarkupFilter>
initializeMarkupFilters
(Markup markup) Create a new markup filter chain and initialize with all default filters required.final Markup
parse()
Reads and parses markup from a file.protected void
postProcess
(Markup markup) final void
setWicketNamespace
(String namespace) In case you want to analyze markup which BY DEFAULT does not use "wicket" to find relevant tags.toString()
-
Field Details
-
CONDITIONAL_COMMENT_OPENING
Opening a conditional comment section, which is NOT treated as a comment section
-
-
Constructor Details
-
AbstractMarkupParser
Constructor.- Parameters:
resource
- The markup resource (file)
-
AbstractMarkupParser
Constructor. Usually for testing purposes only- Parameters:
markup
- The markup resource.
-
AbstractMarkupParser
Constructor.- Parameters:
xmlParser
- The streaming xml parser to read and parse the markupresource
- The markup resource (file)
-
-
Method Details
-
getMarkupFilters
- Returns:
- Gets the list of markup filters
-
setWicketNamespace
In case you want to analyze markup which BY DEFAULT does not use "wicket" to find relevant tags.- Parameters:
namespace
-
-
getMarkupResourceStream
Applications which subclass initFilterChain() might also wish to access the markup resource stream.- Returns:
- The markup resource stream
-
initializeMarkupFilters
Create a new markup filter chain and initialize with all default filters required.- Parameters:
markup
-- Returns:
- The list of markup filters to be considered by the markup parser
-
parse
Reads and parses markup from a file.- Returns:
- The markup
- Throws:
IOException
ResourceStreamNotFoundException
-
postProcess
- Parameters:
markup
-
-
handleRawText
- Parameters:
rawMarkup
-- Returns:
- The modified raw markup
-
compressWhitespace
Remove whitespace from the raw markup- Parameters:
rawMarkup
-- Returns:
- rawMarkup
-
toString
-