Recommendations on parsing XML via an InputRange

Chris Piker chris at hoopjump.com
Tue Sep 14 02:43:31 UTC 2021


Hi D

I just finished a ~1K line project using `dxml` as the XML reader 
for my data streams.  It works well in my test examples using 
memory mapped files, but like an impulse shopper I didn't notice 
that dxml requires `ForwardRange` objects.  That's unfortunate, 
because my next enhancement was to start parsing streams as they 
come in from stdin. (doh!)

So I've learned my lesson and will RTFM closer next time, but now 
I'm casting about for a solution.  Two ideas, either:

1. Find a different StAX-ish parser that works with `InputRange` 
(and buffers internally a bit if needed), or

2. Find a way to represent standard input as a ForwardRange 
without saving the whole stream in memory. (iopipe?)

Dxml is very nice, as I have small sections of the stream that I 
parse into a DOM, but the majority of the items are handled and 
discarded element by element.

Any recommendations?




More information about the Digitalmars-d-learn mailing list