开发者

Is there a way to, find and replace the text value between nodes of a corrupt xml file, using libxml?

开发者 https://www.devze.com 2023-02-06 14:56 出处:网络
libxml, info. needed without actually parsing the file. Is there a way to, find and replace the text val开发者_如何学Pythonue between nodes of a corrupt xml file, using libxml?In general - no. It dep

libxml, info. needed without actually parsing the file.

Is there a way to, find and replace the text val开发者_如何学Pythonue between nodes of a corrupt xml file, using libxml?


In general - no. It depends on how the file is corrupted. Please clarify it.


I know libxml via PHP, so I'm not sure this works for you: Use loadHTMLFile instead of load. This way even a corrupted file can be loaded, if it's not more corrupted than usual websites ;-)
Once loaded, you can handle it like any normal XML. If you save it, the file will be repaired.
If this does not work, the file has heavy damages. Then there is no way to access the file with libxml.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号