wicket.markup
Class MarkupParser

java.lang.Object
  extended by wicket.markup.MarkupParser

public class MarkupParser
extends java.lang.Object

This is a Wicket 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..

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:
IMarkupFilter, IMarkupParserFactory, IMarkupSettings, Markup

Constructor Summary
MarkupParser(IXmlPullParser xmlParser)
          Constructor.
 
Method Summary
 void appendMarkupFilter(IMarkupFilter filter)
          Append a new filter to the list of already pre-configured markup filters.
protected  java.lang.String compressWhitespace(java.lang.String rawMarkup)
          Remove whitespaces from the raw markup
protected  MarkupResourceStream getMarkupResourceStream()
          Applications which subclass initFilterChain() might also wish to access the markup resource stream.
protected  void initFilterChain()
          By default don't do anything.
 Markup parse(java.lang.String string)
          Parse the markup.
 Markup readAndParse(MarkupResourceStream resource)
          Reads and parses markup from a file.
 void setWicketNamespace(java.lang.String namespace)
          In case you want to analyze markup which BY DEFAULT does not use "wicket" to find relevant tags.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarkupParser

public MarkupParser(IXmlPullParser xmlParser)
Constructor.

Parameters:
xmlParser - The streaming xml parser to read and parse the markup
Method Detail

setWicketNamespace

public final void setWicketNamespace(java.lang.String namespace)
In case you want to analyze markup which BY DEFAULT does not use "wicket" to find relevant tags.

Parameters:
namespace -

getMarkupResourceStream

protected MarkupResourceStream getMarkupResourceStream()
Applications which subclass initFilterChain() might also wish to access the markup resource stream.

Returns:
The markup resource stream

initFilterChain

protected void initFilterChain()
By default don't do anything. Subclasses may append additional markup filters if required.

See Also:
appendMarkupFilter(IMarkupFilter)

appendMarkupFilter

public final void appendMarkupFilter(IMarkupFilter filter)
Append a new filter to the list of already pre-configured markup filters. To be used by subclasses which implement initFilterChain().

Parameters:
filter - The filter to be appended

readAndParse

public final Markup readAndParse(MarkupResourceStream resource)
                          throws java.io.IOException,
                                 ResourceStreamNotFoundException
Reads and parses markup from a file.

Parameters:
resource - The file
Returns:
The markup
Throws:
java.io.IOException
ResourceStreamNotFoundException

parse

public final Markup parse(java.lang.String string)
                   throws java.io.IOException,
                          ResourceStreamNotFoundException
Parse the markup.

Parameters:
string - The markup
Returns:
The markup
Throws:
java.io.IOException
ResourceStreamNotFoundException

compressWhitespace

protected java.lang.String compressWhitespace(java.lang.String rawMarkup)
Remove whitespaces from the raw markup

Parameters:
rawMarkup -
Returns:
rawMarkup


Copyright © 2004-2007 Wicket developers. All Rights Reserved.