Skip to content

Instantly share code, notes, and snippets.

@antoineandrieu
Last active October 16, 2023 14:29
Show Gist options
  • Save antoineandrieu/939d86bf9c41d2f952b2041d855d456f to your computer and use it in GitHub Desktop.
Save antoineandrieu/939d86bf9c41d2f952b2041d855d456f to your computer and use it in GitHub Desktop.
Golang XML parsing methods comparison
Criteria / Method Parsing Style Language Binding Memory Footprint Flexibility Complexity Error Handling XPath Support Actively Maintained Performance
encoding/xml (Standard lib) DOM Go High High Moderate Good No Yes Moderate
xml.Decoder (Streaming) Streaming Go Low Moderate Low Good No Yes High
Byte-Level
Manipulation
N/A Go Extremely Low Low High Poor No N/A Extremely High
gokogiri DOM & SAX C & Go Moderate High Moderate Good Yes No High
xmlstream Streaming Go Low Moderate Low Good No No High
fastxml DOM Go Low Moderate Low Good No No High
xmlquery DOM Go Moderate High Moderate Good Yes No Moderate
mxj DOM Go High High Moderate Good No No Moderate
lestrrat-go/libxml2 DOM C & Go Low High High Good Yes No ?
Custom
Implementation
Custom Go Variable High High Variable Variable N/A Variable
Hybrid
Approach
Mixed Go Variable High High Variable Variable N/A Variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment