[XML-SIG] replace ENTITY_NODE ?

Martin v. Loewis martin@v.loewis.de
01 Oct 2002 19:29:32 +0200


J=FCrgen Schmidt <scjuonline@web.de> writes:

> I'm using version 0.8 of PyXML.

You might want to try 0.8.1, it has slightly improved in this area.

> And the parser is chosen by the Reader class. I tried validating and
> non-validating, so it should be pyexpat and xmlproc.

Correct.

> First I tought, an ENTITY Node could be created through the callback
> function of the EntityResolver : resolveEntity of SAX. But this
> function is called only for external entities, right?

I feel a terminology problem here: You have the entity declaration,

<!ENTITY foo SYSTEM "http://python.org/docbook.dtd">

This declaration might occur either in the internal subset, or in the
external subset - in either case, it is an external entity. An
internal entity reads

<!ENTITY foo "bar">

and, again, it may either occur in the internal, or the external
subset. resolveEntity is called to retrieve external entity
definitions, in particular if they occur in the internal subset.

What do you expect to be represented with an Entity node?

> And the DTDHandler functions aren't called neither for the entities
> I'm intersted in.

The DTDHandler functions are called only for notation declarations,
and unparsed entities; I believe you are talking about parsed general
entities, and perhaps parameter entities.

> Are there other solutions to build a DOM -tree than using SAX API?

Yes, you can use the native parser API.

> Or is the native parser interface the solution?

Not for this problem. More precisely, it depends on the parser. You
should explain what exactly the document is that you want represented,
and how exactly you want it to be represented. Some parser may expose
the information you are interested in, another may not.

> As I stated earlier, I just started using Python and using all its XML
> extensions. I'm still on the surface ;-)

I found that the entity stuff in XML is very complex itself, and I'm
still confused by notations and unparsed entities. You should make
sure you understand all aspects of that first, before starting to look
into processing them with Python.

Regards,
Martin