TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: A 6KB, fast and mostly-correct XML parser in C

3 点作者 yorhel超过 11 年前

1 comment

mtdewcmu超过 11 年前
This looks interesting. Is it brand new? I&#x27;ve seen parsers with similar names, but, of course, almost all short letter combinations containing xml have been used, so that&#x27;s expected.<p>It doesn&#x27;t allocate or buffer, so when it says that it verifies proper nesting, I assume that doesn&#x27;t mean verifying that start tags and end tags have matching names. I think that would be impossible.<p>I&#x27;ve been looking for a decent C parser similar to this to try some experiments with. Dealing with XML can be dreary, but I like to try to think of how you might make an API that doesn&#x27;t make your code suck. It would be at a higher level, so I might be able to use this.<p>It looks like you pass the parse function a character at a time. To be fast, you&#x27;d want to somehow encourage that to get inlined. I&#x27;m not sure how easy or possible it is when you put the function in a separate .c file. There would probably be ways to stuff everything into the header.<p>I&#x27;m interested particularly in parsers that don&#x27;t buffer. It seems like a fundamentally more flexible and potentially better way to parse XML is by memory mapping and letting the VM do what it does best.
评论 #6733933 未加载