Re: How to use attributes from custom namespaces

Jim Fulton wrote:
> Hi,
> 
> I'd like to use Amaya to edit XHTML source that includes extra
> attributes from other namspaces.

The current version of Amaya supports only a few XML vocabularies,
namely XHTML, MathML, SVG and XLink. You can mix elements from those
vocabularies in a single document, but no other vocabularies.
The Amaya team is working on generic XML support, but this work
is just starting.

> We are working on a templating
> mechanism, http://dev.zope.org/Wikis/DevSite/Projects/ZPT, to
> allow dynamic generation of XHTML from source that has standard
> XHTML elements and extra attributes to control dynamic generation.

Amaya will allow you to do that, as soon as the generic XML support
is available.  A new release is scheduled for early March, but the
work won't be finished for that one. You'll have to wait for a later
release.

> I give Amaya source like:
> 
>  <html xmlns="http://www.w3.org/1999/xhtml"
>       xmlns:tal="http://xml.zope.org/namespaces/tal"
>       lang="en">
>   <head>
>     <title tal:insert="here/title">zpt demo folder</title>
>   </head>
>   <body>
>     <h1 tal:insert="here/title">zpt demo folder</h1>
>   </body>
>  </html>
> 
> It complains about the tal:insert attributes,

It just says that it does not know that attribute, which does not belong
to the vocabularies (or namespaces) it supports.

> although it doesn't
> mind the tal namespace declaration and even figures out that the prefix
> 'tal' goes with the namespace 'http://xml.zope.org/namespaces/tal'.

The parser is a generic XML parser (Expat) that knows about namespaces
in general, but it does not know any particular namespace. This parser
passes elements and attributes to the tree processor which then
discards the elements and attributes belonging to unknown namespaces.

> If I make any change to the source or save it, the tal attributes
> and namespace declaration are removed.

Actually, they are removed when downloading the document.

> Is there a way to make Amaya
> keep, but otherwise ignore the extra namespace?

Yes, generic support of XML.

> If the answer involves extending Amaya, then I'll take my question
> to www-amaya-dev. :)

It involves extending Amaya. That's in progress. Be patient.

Vincent.

> Jim
> 
> --
> Jim Fulton           mailto:jim@digicool.com   Python Powered!        
> Technical Director   (888) 344-4332            http://www.python.org  
> Digital Creations    http://www.digicool.com   http://www.zope.org

Received on Thursday, 15 February 2001 08:56:28 UTC