I have a xml file and I need to add a namespace and an attribute associated to the namespace.
The original xml looks this way
<ns0:quakeml xmlns:ns0="http://ift.tt/11LkHVW" xmlns="http://ift.tt/1uKZhBO">
<eventParameters publicID="smi:URI/id">
<event publicID="URI/id">
I need to add a namespace defined as
xmlns:catalog="http://ift.tt/11LkHW1"
and a parameter to the event tag'http://ift.tt/11LkHW1'
catalog:datasource="foo"
Actually I do :
xml.set("{http://ift.tt/11LkHW5", 'http://ift.tt/11LkHW1')
so I get
<ns0:quakeml xmlns:ns0="http://ift.tt/11LkHVW" xmlns="http://ift.tt/1uKZhBO" xmlns:ns1="http://ift.tt/11LkHW1" ns1:catalog="http://ift.tt/11LkHW1">
not exactly the same I want.
To insert the attribute I do
event.attrib['eventsource'] = 'foo'
but it doesnt add any namespace
No comments:
Post a Comment