Can CDATA sections be preserved by BeautifulSoup?

后端 未结 1 1517
长情又很酷
长情又很酷 2020-12-18 09:14

I\'m using BeautifulSoup to read, modify, and write an XML file. I\'m having trouble with CDATA sections being stripped out. Here\'s a simplified example.

The culp

相关标签:
1条回答
  • 2020-12-18 09:45

    In my case if I use

    soup = BeautifulSoup( xmlfile, "lxml-xml" )
    

    then cdata is preserved and accesible.

    0 讨论(0)
提交回复
热议问题