org.apache.wicket.markup.parser
Interface IXmlPullParser

All Superinterfaces:
IMarkupFilter
All Known Implementing Classes:
XmlPullParser

public interface IXmlPullParser
extends IMarkupFilter

The interface of a streaming XML parser as required by Wicket.

Author:
Juergen Donnerstag, Jonathan Locke

Method Summary
 java.lang.String getEncoding()
          Return the encoding applied while reading the markup resource.
 java.lang.CharSequence getInput(int fromPos, int toPos)
          Wicket dissects the markup into Wicket relevant tags and raw markup, which is not further analyzed by Wicket.
 java.lang.CharSequence getInputFromPositionMarker(int toPos)
          Wicket dissects the markup into Wicket relevant tags and raw markup, which is not further analyzed by Wicket.
 java.lang.String getXmlDeclaration()
          Return the XML declaration string, in case if found in the markup.
 boolean next()
          Dissect the XML markup into tags and text.
 void parse(java.lang.CharSequence string)
          Parse the markup provided.
 void parse(java.io.InputStream inputStream)
          Reads and parses markup from an input stream, using UTF-8 encoding by default when not specified in XML declaration.
 void parse(java.io.InputStream inputStream, java.lang.String encoding)
          Reads and parses markup from an input stream.
 void setPositionMarker()
          Set the position marker of the markup at the current position.
 void setPositionMarker(int pos)
          Set the position marker of the markup
 
Methods inherited from interface org.apache.wicket.markup.parser.IMarkupFilter
getParent, nextTag, setParent
 

Method Detail

getEncoding

java.lang.String getEncoding()
Return the encoding applied while reading the markup resource. The encoding is determined by analyzing the <?xml version=".." encoding=".." ?> tag.

Returns:
if null, JVM defaults have been used.

getXmlDeclaration

java.lang.String getXmlDeclaration()
Return the XML declaration string, in case if found in the markup.

Returns:
Null, if not found.

getInputFromPositionMarker

java.lang.CharSequence getInputFromPositionMarker(int toPos)
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.

Parameters:
toPos - To position
Returns:
The raw markup in between the position marker and toPos

getInput

java.lang.CharSequence getInput(int fromPos,
                                int toPos)
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.

Parameters:
fromPos - From position
toPos - To position
Returns:
The raw markup in between fromPos and toPos

next

boolean next()
             throws java.text.ParseException
Dissect the XML markup into tags and text. Tags are further analyzed into comments, CDATA, processing instruction etc as well as "standard" tags. By means of getType() the type of the current element can be retrieved and the appropriate getters must used to get hold of the information.

Returns:
false, if end-of-file as been reached. If true, than use getType() to determine what has been found.
Throws:
java.text.ParseException

parse

void parse(java.lang.CharSequence string)
           throws java.io.IOException,
                  ResourceStreamNotFoundException
Parse the markup provided. Use nextTag() to access the tags contained one after another.

Note: xml character encoding is NOT applied. It is assumed the input provided does have the correct encoding already.

Parameters:
string - The markup to be parsed
Throws:
java.io.IOException - Error while reading the resource
ResourceStreamNotFoundException - Resource not found

parse

void parse(java.io.InputStream inputStream)
           throws java.io.IOException,
                  ResourceStreamNotFoundException
Reads and parses markup from an input stream, using UTF-8 encoding by default when not specified in XML declaration. Use nextTag() to access the tags contained, one after another.

Parameters:
inputStream - The input stream to read and parse
Throws:
java.io.IOException - Error while reading the resource
ResourceStreamNotFoundException - Resource not found

parse

void parse(java.io.InputStream inputStream,
           java.lang.String encoding)
           throws java.io.IOException,
                  ResourceStreamNotFoundException
Reads and parses markup from an input stream. Use nextTag() to access the tags contained, one after another.

Parameters:
inputStream - A resource like e.g. a file
encoding - Use null to apply JVM/OS default
Throws:
java.io.IOException - Error while reading the resource
ResourceStreamNotFoundException - Resource not found

setPositionMarker

void setPositionMarker()
Set the position marker of the markup at the current position.


setPositionMarker

void setPositionMarker(int pos)
Set the position marker of the markup

Parameters:
pos -


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.