[XML-SIG] Documentation and problems

Simon Pepping spepping@scaprea.hobby.nl
Tue, 29 Dec 1998 19:31:23 +0100 (MET)


Hi,

I have spent quite some time with the XML package, mainly with the SAX
interface and xmlproc. As a result I have written a(nother) document
about the interaction of an application and a SAX parser, and how to
write a SAX application. I also wrote a simple application to
demonstrate it.

Check it out at http://www.hobby.nl/~scaprea/XML/index.html.

I also made a short list of problems I encountered:

Pr. SAXParseException.__str__ reads:

return "%s at %s:%d:%d" % (self.msg,self.getSystemId(),
    self.getColumnNumber(),self.getLineNumber())

getColumnNumber and getLineNumber should be swapped.

========================

Pr. pyexpat does not report the document name with the getSystemId
method:

Document: 
Fatal error: not well-formed at :5:1 (SAXParseException.__str__)

========================

Pr. XMLValidator does not use my error handlers:

ERROR: Didn't match [A-Za-z_:][\-A-Za-z_:.0-9]* at ./waarnemingen.dtd:17:25
TEXT: '#PCDATA )>'

Possible cause: XMLValidator.reset() and
XMLValidator.set_dtd_listener().
With these modifications it works, but now the location in the DTD is no
longer reported:

    def reset(self):
        self.dtd=CompleteDTD(ErrorHandler(self.parser))
        # added SP 1998/12/23
        self.dtd.set_dtd_listener(self.parser.dtd_listener)
        # added SP 1998/12/23
        self.dtd.set_error_handler(self.parser.err)
        self.val=ValidatingApp(self.dtd)
        self.val.set_real_app(self.app)
        # added SP 1998/12/23
        self.val.set_error_handler(self.parser.err)

        self.parser.reset()
        self.parser.set_application(self.val)
        self.parser.dtd=self.dtd
        self.parser.ent=self.dtd
        
    def set_dtd_listener(self,dtd_listener):
        self.parser.set_dtd_listener(dtd_listener)
        # added SP 1998/12/23
        self.dtd.set_dtd_listener(dtd_listener)

========================

Pr. drv_xmlproc does not implement a getPublicId method:

    # added SP 1998/12/24
    def getPublicId(self):
        # Hmmm, the parser has no method to get the PubID
        # return self.parser.get_current_pubid()
        return 'unknown'

=========================

Pr. XMLValidator does not accept spaces around #PCDATA as content in
an element type declaration:

<!ELEMENT	period					( #PCDATA )>

ERROR: Didn't match [A-Za-z_:][\-A-Za-z_:.0-9]* at ./waarnemingen.dtd:17:25
TEXT: '#PCDATA )>'

=========================

Pr. XMLValidator does not accept the following construction in an
external DTD:

<!ENTITY %  tekst                   "(#PCDATA|taxon|label|opsomming)*">
<!ELEMENT   p                       (%tekst;)>

ERROR: Didn't match [A-Za-z_:][\-A-Za-z_:.0-9]* at waarnemingen.dtd:22:38
TEXT: '%tekst;)>
'
(the declaration of p is line 22)

I am not sure whether this is allowed. nsgmls gives the warning:
'#PCDATA in nested model group'. 

I hope this is useful. And thanks for the work you have already put
into this. It generally works fine.

Simon Pepping
email: spepping@scaprea.hobby.nl