Sax
mattkanwisher opened this issue · 3 comments
Do you guys have any plans for sax? We are starting to be needing it, might implement it. So was going to check if you had started it or had any ideas/concerns
Hmm, interesting. We currently don't have any plans to support SAX style parsing. If you're feeling ambitious, I'd say go for it! I believe libxml has some support for it.
It's not immediately obvious from the documentation, but you can do SAX processing using the standard 'encoding/xml" package.
You need to consume Decoder.Token until you get an io.EOF (or some other error); switch on the token type (xml.StartElement, xml.CharData, etc) and either do your handling or push something to a channel to represent an event.
The standard encoding/xml
package has very low performance, so the only way to parse huge XML files is SAX parsing: golang/go#21823