extra xml header with ElementTree?

Tim Arnold tiarno at sas.com
Fri May 25 09:55:04 EDT 2007


Hi, I'm using ElementTree which is wonderful. I have a need now to write out 
an XML file with these two headers:
<?xml version="1.0" encoding="UTF-8" ?>
<?NLS TYPE="org.eclipse.help.toc"?>

My elements have the root named tocbody and I'm using:
newtree = ET.ElementTree(tocbody)
newtree.write(fname)

I assume if I add the encoding arg I'll get the xml header:
newtree = ET.ElementTree(tocbody)
newtree.write(fname,encoding='utf-8')

but how can I get the <?NLS TYPE="org.eclipse.help.toc"?> into the tree?

python2.4.1,hpux10,ElementTree1.2.6

thanks,
--Tim 





More information about the Python-list mailing list