I wish to automatically write a collective XML file using lxml and therefore I need to write "xi:include" something like:
...
<Time Type="Single" Value="2"/>
<xi:include href="elemData_2.xmf" xpointer="xpointer(//XDMF/Domain/Grid)"/>
<Time Type="Single" Value="3"/>
<xi:include href="elemData_3.xmf" xpointer="xpointer(//XDMF/Domain/Grid)"/>
<Time Type="Single" Value="4"/>
<xi:include href="elemData_4.xmf" xpointer="xpointer(//XDMF/Domain/Grid)"/>
...
It seems that XInclude() is only for parsing and trying to append a SubElement of name: 'xi:include' issues an error. So I would appreciate help for doing it. The code I use:
xdmfItem.append(etree.SubElement(Grid, "xiinclude", {'href': 'elemData_'+str(ii+1)+'.xmf', 'xpointer':'xpointer(//XDMF/Domain/Grid)' }))
The error:
ValueError: Invalid tag name u'xi:include'
Thanks in advance Hisham
EDIT: (if I wait 8 hours I would probably not write the answer)
Thanks newtover, your pointer helped me find the solution:
xdmfItem.append(etree.SubElement(Grid, "{http://www.w3.org/2003/XInclude}include", {'href': 'elemData_'+str(ii+1)+'.xmf', 'xpointer':'xpointer(//XDMF/Domain/Grid)' }))