org.apache.wicket.markup.parser
Interface IXmlPullParser

All Known Implementing Classes:
XmlPullParser

public interface IXmlPullParser

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

Author:
Juergen Donnerstag, Jonathan Locke

Nested Class Summary
static class IXmlPullParser.ELEMENT_TYPE
          The last element found
 
Method Summary
 CharSequence getDoctype()
          Gets the <!DOCTYPE ...> tag if found in the markup
 MarkupElement getElement()
           
 String getEncoding()
          Return the encoding applied while reading the markup resource.
 CharSequence getInput(int fromPos, int toPos)
          Wicket dissects the markup into Wicket relevant tags and raw markup, which is not further analyzed by Wicket.
 CharSequence getInputFromPositionMarker(int toPos)
          Wicket dissects the markup into Wicket relevant tags and raw markup, which is not further analyzed by Wicket.
 CharSequence getXmlDeclaration()
          Return the XML declaration string, in case if found in the markup.
 IXmlPullParser.ELEMENT_TYPE next()
          Move to the next XML element
 void parse(CharSequence string)
          Parse the markup provided.
 void parse(InputStream inputStream)
          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 setPositionMarker()
          Set the position marker of the markup at the current position.
 void setPositionMarker(int pos)
          Set the position marker of the markup
 

Method Detail

getEncoding

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

CharSequence getXmlDeclaration()
Return the XML declaration string, in case if found in the markup.

Returns:
Null, if not found.

getDoctype

CharSequence getDoctype()
Gets the <!DOCTYPE ...> tag if found in the markup

Returns:
Null, if not found

getInputFromPositionMarker

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

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

parse

void parse(CharSequence string)
           throws 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:
IOException - Error while reading the resource
ResourceStreamNotFoundException - Resource not found

parse

void parse(InputStream inputStream)
           throws 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:
IOException - Error while reading the resource
ResourceStreamNotFoundException - Resource not found

parse

void parse(InputStream inputStream,
           String encoding)
           throws 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:
IOException - Error while reading the resource
ResourceStreamNotFoundException - Resource not found

next

IXmlPullParser.ELEMENT_TYPE next()
                                 throws ParseException
Move to the next XML element

Returns:
o, if end of file. Else a TAG, COMMENT etc.
Throws:
ParseException

getElement

MarkupElement getElement()
Returns:
The current element

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-2011 Apache Software Foundation. All Rights Reserved.