Class XMLProcessor - A parser that performs a complete well-formedness check.

Class XMLProcessor - A parser that performs a complete well-formedness check.

SYNOPSIS

import xmlproc
class XMLProcessor(AbstractXML)
  def __init__(self)
  string __module__ = 'xmlproc'
  def do_parse(self,final=0)
  def parseEnd(self)
  def parseStart(self)
  def parse_cdata(self)
  def parse_charref(self)
  def parse_comment(self)
  def parse_data(self)
  def parse_doctype(self)
  def parse_end_tag(self)
  def parse_ent_ref(self)
  def parse_internal_dtd(self)
  def parse_pi(self)
  def parse_start_tag(self)
  def parse_xml_decl(self)

  # Methods inherited by XMLProcessor from AbstractXML
  def parse_string(self,org_val,allow_ext_ges,allow_pes)

  # Methods inherited by XMLProcessor from EntityParser
  def feed(self,new_data)
  def find_reg(self,regexp)
  def get_current_sysid(self)
  def get_index(self,target)
  def get_match(self,regexp)
  def get_pos(self)
  def get_region(self)
  def get_wrapped_match(self,wraps)
  def now_at(self,test_str)
  def open_entity(self,sysID)
  def parse_resource(self,sysID)
  def pop_entity(self)
  def push_entity(self,sysID,contents)
  def read_from(self,fileobj,bufsize=16384)
  def scan_to(self,target)
  def set_application(self,app)
  def set_entity_handler(self,ent)
  def set_error_handler(self,err)
  def set_start_point(self)
  def set_sysid(self,sysID)
  def skip_ws(self)
  def test_reg(self,regexp)
  def test_str(self,test_str)
  def update_pos(self)

DESCRIPTION

def do_parse(self,final=0)

Does the actual parsing.

def feed(self,new_data)

Accepts more data from the data source. This method must set self.datasize and correctly update self.pos and self.data.

def find_reg(self,regexp)

Moves self.pos to the first character that matches the regexp.

def get_current_sysid(self)

Returns the sysid of the file we are reading now.

def get_index(self,target)

Finds the position where target starts and returns it.

def get_match(self,regexp)

Returns the result of matching the regexp and advances self.pos.

def get_pos(self)

Returns a tuple (line,col).

def get_region(self)

Returns the area from start_point to current position and remove start_point.

def get_wrapped_match(self,wraps)

Returns a contained match. Useful for regexps inside quotes.

def now_at(self,test_str)

Checks if we are at this string now, and if so skips over it.

def open_entity(self,sysID)

Starts parsing a new entity, pushing the old onto the stack. This method must not be used to start parsing, use parse_resource for that.

def parseEnd(self)

Must be called when parsing is finished. (Cleans up and notifies application.

def parseStart(self)

Must be called before parsing starts. (Notifies application.)

def parse_cdata(self)

Parses a CDATA marked section from after the <![CDATA[.

def parse_charref(self)

Parses a character reference.

def parse_comment(self)

Parses the comment from after <!-- and beyond -->.

def parse_data(self)

Parses character data.

def parse_doctype(self)

Parses the document type declaration.

def parse_end_tag(self)

Parses the end tag from after the </ and beyond >.

def parse_ent_ref(self)

Parses a general entity reference from after the &.

def parse_internal_dtd(self)

Parse the internal DTD beyond the ]>.

def parse_pi(self)

Parses a processing instruction from after the <? and beyond the ?>.

def parse_resource(self,sysID)

Begin parsing an XML entity with the specified public and system identifiers (the system identifier, a URI, is required). Only used to start parsing, not to handle subentities, which open_entity takes care of.

def parse_start_tag(self)

Parses the start tag.

def parse_string(self,org_val,allow_ext_ges,allow_pes)

Parses a string (attribute value, entity value) and resolves all entity references in it. allow_ext_ges specifies whether external general entity references are allowed. allow_pes specifies whether parameter entities are allowed at all.

def parse_xml_decl(self)

Parses the contents of the XML declaration from after the !xml.

def pop_entity(self)

Skips out of the current entity and back to the previous one.

def push_entity(self,sysID,contents)

Parse some text and consider it a new entity, making it possible to return to the original entity later.

def read_from(self,fileobj,bufsize=16384)

Reads data from a file-like object until EOF. Does not close it. WARNING: This method does not call the parseStart/parseEnd methods, since it does not know if it may be called several times. Use parse_resource if you just want to read a file.

def scan_to(self,target)

Moves self.pos to beyond target and returns skipped text.

def set_application(self,app)

Sets the object to send data events to.

def set_entity_handler(self,ent)

Sets the object that resolves entity references.

def set_error_handler(self,err)

Sets the object to send error events to.

def set_start_point(self)

Stores the current position and tells the parser not to forget any of the data beyond this point until get_region is called.

def set_sysid(self,sysID)

Sets the current system identifier. Does not store the old one.

def skip_ws(self)

Skips over any whitespace at this point.

def test_reg(self,regexp)

Checks if we match the regexp.

def test_str(self,test_str)

See if text at current position matches test_str, without moving.

def update_pos(self)

Updates (line,col)-pos by checking processed blocks.

SEE ALSO

xmlproc

AbstractXML


Generated by HTMLFormatter at Sat Mar 21 11:51:56 1998