问题描述
我正在使用Xerces-C ++编写一个自定义XML验证器。我当前的方法将文档加载到DOM中,然后执行检查。我需要的是访问DOM中节点的行/列号的方式。我一直在阅读API文档和谷歌搜索,但我很快就会发现。有可能以某种方式检索这种关于节点的信息?实现界面看起来可能会为我提供这种信息,但它会需要完全重写预期的验证架构。坦白说,一个 XMLValidator
方法看起来很丑陋,整体。我有一个不同的,更简单的验证系统(一个也很容易并行化),一切正常;我需要的是节点的行/列号信息。我之前使用的Qt DOM实现(现在我不能使用),所以我看不清为什么Xerces使事情变得困难。
可以找到一个可能的解决方案。
I'm writing a custom XML validator using Xerces-C++. My current approach loads the document into a DOM, and then checks are performed on it. What I need is a way to access the line/column number of a node in the DOM. I've been reading the API docs and googling, but I'm coming up short. Is it possible to somehow retrieve this kind of information about the nodes?
Implementing the XMLValidator
interface looks like it would probably provide me with that kind of info, but it would require completely rewriting the intended validation architecture. Frankly, an XMLValidator
approach seems ugly and monolithic. I have a different and much simpler validation system in mind (one that is also easily parallelizable) and everything works; all I need is the line/column number info of the nodes. The Qt DOM implementation that I've used before (and which I can't use now) provides this information up front, so I can't see why Xerces is making things difficult.
A possible solution can be found here.
这篇关于Xerces-C ++ DOM节点行/列号位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!