Burak Arslan, 18.09.2013 21:35:
> On 09/18/13 21:59, Roy Smith wrote:
>> I can create an Element with a 'foo' attribute by doing:
>>
>> etree.Element('my_node_name', foo="spam")
>>
> xmlns: is a prefix with a special meaning: it defines an xml namespaces
> prefix. you should read about how they work.
Absolutely. For the specific case of a namespaced attribute, one way to do
it goes like this:
el = etree.Element('my_node_name')
el.set('{
http://www.w3.org/2001/XMLSchema-instance}xsi', 'int')
For this specific namespace, and also a couple of other well-known
namespace URIs, lxml will use the "expected" prefix by default.
Stefan