XLSForm / pyxform

A Python package to create XForms for ODK Collect.
BSD 2-Clause "Simplified" License
82 stars 138 forks source link

Add ability to add additional namespaces #65

Closed MartijnR closed 8 years ago

MartijnR commented 8 years ago

Referring to Esri's additions and to custom features I am working on, it would be great if we could add additional space-separated prefix="namespace" e.g. in the settings sheet under a namespaces column that result in the corresponding xmlns attributes on the html element.

namespaces
esri="http://esri.com/xforms" enk="http://enketo.org/xforms" naf="http://nafundi.com/xforms"

This would allow us to use survey columns such as: bind::esri:fieldType and bind::nk2:myattribute and not be tempted to either use no namespace or an incorrect (but already existing) one.

So the above would ensure the following namespace declarations are in the XForm output:

<h:html .... 
    xmlns:esri="http://esri.com/xforms" 
    xmlns:enk="http://enketo.org/xforms" 
    xmlns:naf="http://nafundi.com/xforms"
>
spatialdude commented 8 years ago

FYI the simple modification we made to support the esri namespace was in survey.py -

survey.py
nsmap = {
    u"xmlns": u"http://www.w3.org/2002/xforms",
    u"xmlns:h": u"http://www.w3.org/1999/xhtml",
    u"xmlns:ev": u"http://www.w3.org/2001/xml-events",
    u"xmlns:xsd": u"http://www.w3.org/2001/XMLSchema",
    u"xmlns:jr": u"http://openrosa.org/javarosa",
    u"xmlns:orx": u"http://openrosa.org/xforms",
    u"xmlns:esri": u"http://esri.com/xforms"
    }

An option in the settings sheet would be a lot more flexible.

ukanga commented 8 years ago

@MartijnR we have a PR #75