de.hedenus.mobilexml
Class XMLReader

java.lang.Object
  extended by de.hedenus.mobilexml.XMLReader
All Implemented Interfaces:
XMLParserEventListener

public class XMLReader
extends java.lang.Object
implements XMLParserEventListener

An XML reader which understands namespaces, xml:id, xml:base, xml:space, xml:lang. The XMLReader is based on XMLParser.

Author:
Michael Hedenus

Nested Class Summary
static class XMLReader.Scope
          The scope of an XML element.
 
Constructor Summary
XMLReader(XMLReaderEventListener listener)
           
 
Method Summary
protected  XMLReader.Scope createScope(XMLReader.Scope parent)
          Creates a new scope instance.
 void elementBegin(Element element, java.util.List attributeList)
          Method called when an tag start is encountered.
 void elementEnd(java.lang.String tagName)
          The method called when a tag end is encountered.
 int getLineNumber()
           
 boolean isIgnoreEmptyText()
           
 void read(java.io.InputStream in, java.lang.String encoding, java.lang.String documentBase)
           
 void reset()
           
 void setIgnoreEmptyText(boolean ignoreEmptyText)
           
 void stop()
          Tells the reader to finish parsing as soon as possible.
 void text(java.lang.String text)
          Method called when some plain text between two tags is encountered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLReader

public XMLReader(XMLReaderEventListener listener)
Method Detail

createScope

protected XMLReader.Scope createScope(XMLReader.Scope parent)
Creates a new scope instance. Override this method if you want to create a subclass of the scope.


stop

public void stop()
Tells the reader to finish parsing as soon as possible.


getLineNumber

public int getLineNumber()

reset

public void reset()

read

public void read(java.io.InputStream in,
                 java.lang.String encoding,
                 java.lang.String documentBase)
          throws java.io.IOException,
                 XMLException
Throws:
java.io.IOException
XMLException

isIgnoreEmptyText

public boolean isIgnoreEmptyText()

setIgnoreEmptyText

public void setIgnoreEmptyText(boolean ignoreEmptyText)

elementBegin

public void elementBegin(Element element,
                         java.util.List attributeList)
                  throws XMLException
Description copied from interface: XMLParserEventListener
Method called when an tag start is encountered.

Specified by:
elementBegin in interface XMLParserEventListener
Parameters:
element - the current element
attributeList - the list of Attribute objects (Note: the list is live!)
Throws:
XMLException

elementEnd

public void elementEnd(java.lang.String tagName)
                throws XMLException
Description copied from interface: XMLParserEventListener
The method called when a tag end is encountered.

Specified by:
elementEnd in interface XMLParserEventListener
Throws:
XMLException

text

public void text(java.lang.String text)
          throws XMLException
Description copied from interface: XMLParserEventListener
Method called when some plain text between two tags is encountered.

Specified by:
text in interface XMLParserEventListener
Throws:
XMLException