[XML-SIG] Multiple top nodes

richard@iopen.co.nz richard@iopen.co.nz
Wed, 1 Nov 2000 10:43:52 +1300 (NZDT)


On Tue, 31 Oct 2000, Martin v. Loewis wrote:

> However, it still will use a SAX parser to parse the fragment, and SAX
> does not support parsing fragments. Specifically, the expat parser
> will complain about the ill-formedness of the document.
> 
> If you absolutely need to make this work, then you can use the sgmlop
> driver, which performs less error checking. Unfortunately, FromXml*
> does not support an application-provided driver, so your only solution
> at the moment is to set the environment variable PY_SAX_PARSER to
> xml.sax.drivers.drv_sgmlop. With that setting, my program above
> creates a DocumentFragment.
> 
> Please note that this is abusing defects in sgmlop, which should
> detect errors in the document more reliably. I'm surprised this worked
> with PyXML 0.5.

Thanks for the swift reply.

Now that I follow the reasoning, I'm suprised it worked in 0.5.5 too. I'll
rework the problem, perhaps using a modified file object to surround the
fragment with an arbitrary root tag, then extract the fragment from the
DOM. Not as tidy as I'd hoped, but I take heed from your warning that
doing it the other way would be abusing sgmlop. I'd hate for someone to go
and 'fix' it on me :)

Many thanks,

Richard Waid
Network/Software Engineer
iOpen Technologies Ltd.