If you want to have nested XML, you can do this:
from lxml import objectify doc = objectify.ElementMaker(annotate=False) doc = (objectify.E.configuration(getattr(objectify.E,'networklists'),name="acl.conf",description="Network Lists")) objectify.deannotate(doc,cleanup_namespaces=True)
The output with custom attributes is as follows:
<configuration description="Network Lists" name="acl.conf"> <network-lists> </network-lists> </configuration>
Soraya anvari
source share