I have some html in which I want to replace some tags. I can change the
attributes of a tag using elements but I cannot see any way to actually
replace the tag. I want something similar to this code (which does not work
but shows what I am trying to do)
taghtml=TAG(html)
pagebreaks=taghtml.elements('br[style=page-break-before:always]')
for elem in pagebreaks:
elem=DIV(_style='page-break-before:always')
I have also tried extracting the tag as a string and then doing string
replace on the original html but that does not work either as the string is
changed by the process e.g. putting double quotes around attribute values.