Tuesday, August 13, 2013

This is a simple test to incorporate the SyntaxHighlighter in my blog. Quite handy!
import sys, copy
from xml.sax.drivers.drv_xmlproc_val import *
 
class myParser(SAX_XPValParser):
    """XML parser."""
 
    psl = None
 
    def handle_doctype(self, rootname, pub_id, sys_id):
        self.dtd_handler.doctypeDecl(rootname, pub_id, sys_id, self.psl)
 
 
class docHandler:
    """XML Document events handler."""
 
    def characters(self, ch, start, length):
        """Handle a character data event.
        The data are contained in the substring of ch
        starting at position start and of length length."""
 
        print ch[start:start+length],
 
    def endDocument(self):
        """Handle an event for the end of a document."""
I found the instructions here quite helpful!

No comments: