XMLReader - How to handle undeclared namespace

2019-03-05 15:31发布

I'm reading a large ~300Mb gzipped XML file with XMLReader that get's automatically dumped to my server nightly (archaic, I know..) It is malformed ie, it has an undefined namespace and it's throwing an error

ErrorException [ Warning ]: XMLReader::read() namespace error : Namespace prefix xsi for AttrName on NodeName is not defined

What is the best way to deal with this? It seems impractical to uncompress, load the whole thing into memory, replace a string, write it again -- gzipped. The file is huge.

The whole reason I'm using XMLReader is to prevent loading the whole file into memory during parsing.

What should I do??

0条回答
登录 后发表回答