[kupu-dev] Extending Kupu to edit XML in another namespaces

Roché Compaan roche at upfrontsystems.co.za
Thu Jul 2 22:01:10 CEST 2009


On Tue, 2009-06-23 at 20:19 +0200, Roché Compaan wrote:
> Hi there
> 
> My development team is trying to extend Kupu with some features to allow
> editing of XML in other namespaces, for example MathML. We did manage to
> embed MathML as CDATA but this is not ideal. Our efforts are checked
> into the Plone collective.
> http://svn.plone.org/svn/collective/collective.matheditor/
> FYI, in addition to MathML we also want to extend it to embed QML
> (http://cnx.org/content/m10136/latest/).
> 
> For a start, we would like to know what must be done to tell Kupu to
> leave alone tags in other namespaces. Furthermore, we would like to know
> how you can make Kupu aware of the structure of the embedded XML.
> 
> Is what we are trying to do feasible, or is Kupu meant to edit HTML
> only?

I'm happy to report that this was fun and relatively easy todo. I am
very impressed with how modular and pluggable Kupu is. This is how we
did it:

1. We extended the XhtmlValidation class in common/kupucontentfilters.js
to allow the tags from the namespaces we wanted to use. We realise that
the validation is not always strict, but at least it was easy to tell
Kupu to leave our tags alone. 

2. We created a drawer and some tools to generate our custom tags.

3. We created some CSS rules to style our tags.

One caveat that we can happily live with for the moment is that you
can't use the namespace in the tag eg. <math:mathml> but have to set the
xmlns attribute eg. <math xmlns="http://....">. CSS selectors don't seem
to recognise namespaced tag names either, but they do style simple tag
names.

We will write up what we did and how we did it in more detail once we're
done.

-- 
Roché Compaan
Upfront Systems                   http://www.upfrontsystems.co.za



More information about the kupu-dev mailing list