xml - Python: QName on node's attribute, lxml -


in python's lxml.etree, how add namesapce attribute of node one: name space is:

xs_ns = 'http://www.w3.org/2001/xmlschema' 

result looking is:

<xs:element name="label" type="xs:string"></xs:element>  

i tried 1 result not looking for:

element = et.subelement(     sequence,     et.qname(xs_ns, "element"),     name="label",     type=str(et.qname(xs_ns, "string")), ) 

gave me:

<xs:element name="label" type="{http://www.w3.org/2001/xmlschema}string"/> 

as far know, while attribute self may have namespace, value of attribute doesn't consider namespaces:

<!-- attribute has namespace prefix --> <dummy xs:foo="bar"/> <!-- attribute has value of string containing colon --> <dummy foo="xs:bar"/> 

so can put "prefix" , "value" single string altogether:

type="xs:string" 

related discussion: xml schema. processing namespace-aware attribute values. there it's implicitly stated prefix in attribute value isn't significant, placeholders actual namespaces.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -