emory-libraries / eulxml

Utilities for using XPath to map XML data to Python objects and Django forms
http://eulxml.readthedocs.org
38 stars 12 forks source link

Question about schemaLocation #12

Closed bcail closed 10 years ago

bcail commented 10 years ago

Maybe you can already do this in eulxml - I want to generate MODS documents with the following root element: <mods:mods xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-4.xsd”>

I’m using my own Mods class that inherits from MODSv34, and I was able to add the other namespaces by updating ROOT_NAMESPACES. However, I don’t know how to set xsi:schemaLocation.

Any thoughts?

bcail commented 10 years ago

Looks like you can just define it as a StringField in the class: schema_location = SF('@xsi:schemaLocation', 'self')