org.demac.impl.j2me.process.base.service.webservices.xml.soap.ksoap.kxml.parser
Class AbstractXmlParser

java.lang.Object
  extended by org.demac.impl.j2me.process.base.service.webservices.xml.soap.ksoap.kxml.parser.AbstractXmlParser
Direct Known Subclasses:
TreeParser, XmlParser

public abstract class AbstractXmlParser
extends java.lang.Object

An abstract base class for the XML and WBXML parsers. Of course, you can implement your own subclass with additional features, e.g. a validating parser.


Constructor Summary
AbstractXmlParser()
           
 
Method Summary
 int getLineNumber()
          Returns the current line number; -1 if unknown.
 void ignoreTree()
          Ignores a tree
abstract  ParseEvent peek()
          reads the next event available from the parser without consuming it
 boolean peek(int type, java.lang.String namespace, java.lang.String name)
           
abstract  ParseEvent read()
          reads the next event available from the parser.
 ParseEvent read(int type, java.lang.String namespace, java.lang.String name)
          Reads an event of the given type.
 java.lang.String readText()
          Convenience method for reading the content of text-only elements.
 void readTree(java.util.Vector buf)
          Reads a complete element tree to the given event Vector.
 void setProcessNamespaces(boolean processNamespaces)
          tells the parser if it shall resolve namespace prefixes to namespaces.
 void skip()
          Convenience Method for skip (Xml.COMMENT | Xml.DOCTYPE | Xml.PROCESSING_INSTRUCTION | Xml.WHITESPACE)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXmlParser

public AbstractXmlParser()
Method Detail

ignoreTree

public void ignoreTree()
                throws java.io.IOException
Ignores a tree

Throws:
java.io.IOException

readTree

public void readTree(java.util.Vector buf)
              throws java.io.IOException
Reads a complete element tree to the given event Vector. The next event must be a start tag.

Throws:
java.io.IOException

getLineNumber

public int getLineNumber()
                  throws java.io.IOException
Returns the current line number; -1 if unknown. Convenience method for peek ().getLineNumber ().

Throws:
java.io.IOException

read

public abstract ParseEvent read()
                         throws java.io.IOException
reads the next event available from the parser. If the end of the parsed stream has been reached, null is returned.

Throws:
java.io.IOException

read

public ParseEvent read(int type,
                       java.lang.String namespace,
                       java.lang.String name)
                throws java.io.IOException
Reads an event of the given type. If the type is START_TAG or END_TAG, namespace and name are tested, otherwise ignored. Throws a ParseException if the actual event does not match the given parameters.

Throws:
java.io.IOException

peek

public boolean peek(int type,
                    java.lang.String namespace,
                    java.lang.String name)
             throws java.io.IOException
Throws:
java.io.IOException

skip

public void skip()
          throws java.io.IOException
Convenience Method for skip (Xml.COMMENT | Xml.DOCTYPE | Xml.PROCESSING_INSTRUCTION | Xml.WHITESPACE)

Throws:
java.io.IOException

peek

public abstract ParseEvent peek()
                         throws java.io.IOException
reads the next event available from the parser without consuming it

Throws:
java.io.IOException

setProcessNamespaces

public void setProcessNamespaces(boolean processNamespaces)
tells the parser if it shall resolve namespace prefixes to namespaces. Default is true


readText

public java.lang.String readText()
                          throws java.io.IOException
Convenience method for reading the content of text-only elements. The method reads text until an end tag is reached. Processing instructions and comments are skipped. The end tag is NOT consumed. The concatenated text String is returned. If the method reaches a start tag, an Exception is thrown.

Throws:
java.io.IOException