By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,767 Members | 1,987 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,767 IT Pros & Developers. It's quick & easy.

Expat - how to UseForeignDTD

P: n/a
I have a simple Kid template document:

<?xml version='1.0' encoding='utf-8'?>
import time
title = "A Kid &anything; Template"
<html xmlns=""

.... (snip)

This runs as expected but now I would like to load a DTD without
tampering with this xml file

In the expat parser __init__ after setting other handlers
for parser, I have added:
parser.ExternalEntityRefHandler = self._ExternalEntityRefHandler
parser.UseForeignDTD(1) (also tried True)

Which I understand at some point will call
with None for args and I must have code to get this other dtd.
I have done regular ExternalEntityRefHandlers before.

As required, these two lines occur before my Parse() call.
Perhaps I misunderstand the sequence, or need something more in my
xml file, but my _ExternalEntityRefHandler is never called. The
process behaves as if I never added these two lines.


Oct 20 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I needed to set Entity Parsing, such as

parser.SetParamEntityParsing( expat.XML_PARAM_ENTITY_PARSING_ALWAYS )

Oct 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.