I have a XML body which was constructed using lxml.etree.E
module. It looks like this -
E.TAGA(
E.TAGB(
E.TAGC(
...list goes here...
)
)
)
This method of construction cannot be altered.
I have a list of strings ["textA", "textB", "textC"]
which have to be added to the xml under TAGC
(as shown above) with each entry wrapped inside another tag TAGD
. I have tried using fromStringlist
but it doesn't work. Please help. Hope my question is clear.
This is how the final XML code should appear -
E.TAGA(
E.TAGB(
E.TAGC(
E.TAGD(textA),
E.TAGD(textB),
E.TAGD(textC)
)
)
)
Here is the desired output -
<TAGA>
<TAGB>
<TAGC>
<TAGD>textA</TAGD>
<TAGD>textB</TAGD>
<TAGD>textC</TAGD>
</TAGC>
</TAGB>
</TAGA>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…