class ArchDocHandler - SAX DocumentHandler for processing XML architectures.

Declared in module xml.arch.xmlarch

Inheritance hierarchy:

xml.arch.xmlarch.ArchDocHandler
  xml.sax.saxlib.DocumentHandler

Synopsis

class ArchDocHandler(DocumentHandler):
    def __init__(self, default_doc_handler=None) # Initialize a new instance.
    def add_document_handler(self, arch_name, doc_handler) # Add an architecture document handler.
    def characters(self, ch, start, length) # Handle a character data event.
    def clear_document_handlers(self) # Remove all registered architecture document handlers.
    def endDocument(self) # Handle an event for the end of a document.
    def endElement(self, name) # Handle an event for the end of an element.
    def get_architecture(self, arch_name) # Get the Architecture object for a given architecture.
    def get_current_element_name(self)
    def ignorableWhitespace(self, ch, start, length) # Handle an event for ignorable whitespace in element content.
    def processingInstruction(self, target, data) # Handle a processing instruction event.
    def remove_document_handler(self, arch_name, doc_handler) # Remove an architecture document handler.
    def scan_arch_attrs(self, arch, org_attrs) # Scan an elements attributes for architectural information, and return a modified set of attributes.
    def setDocumentLocator(self, locator) # Receive an object for locating the origin of SAX document events.
    def set_debug_level(self, debug_level, debug_file=<open file '<stderr>', mode 'w' at 80b0a08>) # Set the debug level and the debug file.
    def set_default_document_handler(self, handler) # Set a default document handler that receives the same events as this class.
    def startDocument(self) # Handle an event for the beginning of a document.
    def startElement(self, name, attrs) # Handle an event for the beginning of an element.

    # Inherited from xml.sax.saxlib.DocumentHandler
    def characters(self, ch, start, length) # Handle a character data event.
    def endDocument(self) # Handle an event for the end of a document.
    def endElement(self, name) # Handle an event for the end of an element.
    def ignorableWhitespace(self, ch, start, length) # Handle an event for ignorable whitespace in element content.
    def processingInstruction(self, target, data) # Handle a processing instruction event.
    def setDocumentLocator(self, locator) # Receive an object for locating the origin of SAX document events.
    def startDocument(self) # Handle an event for the beginning of a document.
    def startElement(self, name, atts) # Handle an event for the beginning of an element.

Description

This class is responsible for doing architectural processing of all SAX events that it receives.

The ArchDocHandler instance must be registered with a parser that triggers SAX events during parsing. This is usually done by calling the parsers setDocumentHandler method.

DocumentHandlers that is interested in listening to architectural events must register itself using the add_document_handler method of the ArchDocHandler instance. They may remove themselves by calling remove_document_handler.

All registered DocumentHandlers can be removed by calling clear_document_handlers.

add_document_handler(self, arch_name, doc_handler)

Add an architecture document handler.

This method adds the DocumentHandler to the architecture's list of architectural event listeners.

clear_document_handlers(self)

Remove all registered architecture document handlers.

This method removes all DocumentHandlers in the architecture's list of architectural event listeners.

get_architecture(self, arch_name)

Get the Architecture object for a given architecture.

The Architecture object will allow you to get information about the architecture and information about its parse state.

remove_document_handler(self, arch_name, doc_handler)

Remove an architecture document handler.

This method removes all occurences of the DocumentHandler in the architecture's list of architectural event listeners.

scan_arch_attrs(self, arch, org_attrs)

Scan an elements attributes for architectural information, and return a modified set of attributes.

arch must be an object that implements the Architecture interface. org_attrs must be a hash containing attribute name/values.

set_debug_level(self, debug_level, debug_file=<open file '<stderr>', mode 'w' at 80b0a08>)

Set the debug level and the debug file.

Debug information is by default written to sys.stderr when debugging is active. This can be changed by specifying the debug_file parameter with a file object. The default debug level is 0, i.e no debugging information is written.

set_default_document_handler(self, handler)

Set a default document handler that receives the same events as this class.

A default DocumentHandler is only used if you want the incoming events passed on to another DocumentHandler.