Is there a way to, find and replace the text value between nodes of a corrupt xml file, using libxml?
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.
精彩评论