Class PullParser

java.lang.Object
org.gjt.xpp.impl.pullparser.PullParser
All Implemented Interfaces:
XmlPullParser, XmlPullParserBufferControl, XmlPullParserEventPosition

public class PullParser extends Object implements XmlPullParser, XmlPullParserBufferControl, XmlPullParserEventPosition
XML Pull Parser (XPP) allows to pull XML events from input stream. Advantages:
  • very simple pull interface - ideal for deserializing XML objects (like SOAP)
  • simple and efficient thin wrapper around Tokenizer class - when compared with using Tokenizer directly adds about 10% for big documents, maximum 50% more processing time for small documents
  • lightweight memory model - minimized memory allocation: element content and attributes are only read on explicit method calls, both StartTag and EndTag can be reused during parsing
  • small - total compiled size around 20K
  • by default supports namespaces parsing (can be switched off)
  • support for mixed content can be explicitly disabled
Limitations:
  • this is beta version - may have still bugs :-)
  • does not parse DTD (recognizes only predefined entities)
Author:
Aleksander Slominski
  • Field Details

    • USE_QNAMEBUF

      protected static final boolean USE_QNAMEBUF
      See Also:
    • CHECK_ATTRIB_UNIQ

      protected static final boolean CHECK_ATTRIB_UNIQ
      Should attribute uniqueness be checked for attributes as in specified XML and NS specifications?
      See Also:
    • emptyElement

      protected boolean emptyElement
      Have we read empty element?
    • seenRootElement

      protected boolean seenRootElement
      Have we seen root element
    • elContent

      protected String elContent
      Content of current element if in CONTENT state
    • tokenizer

      protected Tokenizer tokenizer
      XML tokenizer that is doing actual tokenizning of input stream.
    • eventStart

      protected int eventStart
      start position of current event in tokenizer biffer
    • eventEnd

      protected int eventEnd
      end position of current event in tokenizer biffer
    • state

      protected byte state
      what is current event type as returned from next()?
    • token

      protected byte token
      what is current token returned from tokeizer
    • supportNs

      protected boolean supportNs
      should parser support namespaces?
    • reportNsAttribs

      protected boolean reportNsAttribs
      should parser report namespace xmlns* attributes ?
    • prefix2Ns

      protected Hashtable prefix2Ns
      mapping of names prefixes to uris
    • attrPosEnd

      protected int attrPosEnd
      index for last attribute in attrPos array
    • attrPosSize

      protected int attrPosSize
      size of attrPos array
    • attrPos

      protected Attribute[] attrPos
      temporary array of current attributes
    • elStackDepth

      protected int elStackDepth
      how many elements are on elStack
    • elStackSize

      protected int elStackSize
      size of elStack array
    • elStack

      protected ElementContent[] elStack
      temprary array to keep ElementContent stack
  • Constructor Details

    • PullParser

      public PullParser()
      Create instance of pull parser.
  • Method Details