Amara: Where's my attribute?

AdSR artur_spruce at yahoo.com
Tue Jul 4 15:07:59 EDT 2006


uche.ogbuji at gmail.com wrote:
> What is the actual problem you're trying to solve?  If you just want to
> force a namespace declaration in output (this is sually to support
> QNames in content) the most well-known XML hack is to create a dummy
> attribute with the needed prefix and namespace.  But this does not work
> when you're trying to force a default namespace declaration.  Then
> again, you generally can't use QNames in content with a default
> namespace declaration.  So my guess is that you somehow got way off the
> rails in your problem-solving, and you'll need to provide mre
> background if you want help.

I wanted to remove documentation elements from some XML Schema files.
The problem showed when I tried to use the stripped schemas, because
the namespace declaration for user-defined types was missing. Of
course, since these types are named and referred to in attribute
*values*, Amara had no way to know that the namespace declaration was
still needed (didn't matter if default or non-default). This is more a
problem of how XML Schema is defined against XML namespace rules, since
XML Schena uses namespaces in a context of which XML parsers aren't
normally aware.

> BTW, I recommend upgrading to Amara 1.1.7.  That branch will soon be
> 1.2, and I consider it more mature than 1.0 at this point.  The API's
> also easier:

I know, especially the insert-before/after feature :) But I ran into a
problem that I describe below and you advertised 1.0 as "stable
version", so I switched immediately.

The problem can be reproduced like this:

>>> import amara
>>> amara.parse('http://www.w3.org/2001/XMLSchema.xsd')
START DTD xs:schema -//W3C//DTD XMLSCHEMA 200102//EN XMLSchema.dtd
http://www.w3.org/2001/datatypes.dtd:99:23: Attribute 'id' already
declared
http://www.w3.org/2001/datatypes.dtd:122:23: Attribute 'id' already
declared
http://www.w3.org/2001/datatypes.dtd:130:27: Attribute 'id' already
declared
...some 40 more lines like this and then Python crashes (Windows shows
the bug-reporting dialog)

Thanks for your interest,

AdSR




More information about the Python-list mailing list