pip install Genshi
python
from genshi import XML
xml_content = """
<book>
<title>Programming Guide</title>
<author>John Doe</author>
</book>
"""
doc = XML(xml_content)
title = doc.find('title').text
author = doc.find('author').text
print('Title:', title)
print('Author:', author)
python
from genshi.builder import Element, Fragment, tag
root = Element('book')
title = Element('title')
title.text = 'Programming Guide'
root.append(title)
author = Element('author')
author.text = 'John Doe'
root.append(author)
print(root.serialize())