On the subject of an XML parser
H. S. Teoh
hsteoh at qfbox.info
Mon Aug 22 23:30:58 UTC 2022
On Mon, Aug 22, 2022 at 10:51:44PM +0000, Chris Piker via Digitalmars-d wrote:
> On Monday, 22 August 2022 at 14:51:34 UTC, H. S. Teoh wrote:
>
> > Why not use Jonathan's dxml?
>
> I build a project off of dxml and found it to be quite nice, but I
> forgot to read the fine print (aka the template specialization).
> After a week of development when everything was working well, I tried
> to use it for parsing stdin and that's when the compiler let me know
> than an InputRange wasn't sufficient. Totally my fault, no knock
> against the author.
>
> So depending on the use case, dxml works quite well. For my own
> purposes I'll need to find/create a ForwardRange adapter for stdin or
> refactor my code to use another library.
Do you need to parse xml on-the-fly, or would it work to just slurp the
entire stdin into a buffer and then parse that?
In the former case, you could probably just accumulate incoming stdin
lines into a buffer and parse that (though you'll probably need a
wrapper, otherwise dxml may terminate prematurely at the end of the
current line).
In the latter case it should be a simple matter of using
std.algorithm.copy to read stdin into a buffer, which can then be parsed
with dxml.
T
--
There's light at the end of the tunnel. It's the oncoming train.
More information about the Digitalmars-d
mailing list