的Xerces-C:从V2.X迁移到V3.0的? [英] Xerces-C: Migration from v2.x to v3.x?
问题描述
我想迁移项目从的Xerces-C版本2.x(传统code这我不太熟悉)到V3.0的。
I would like to migrate a project (legacy code which I am not quite familiar with) from Xerces-C v2.x to v3.x.
原来,的Xerces-C V3下降了DOMBuilder类。该迁移归档告诉我:
It turns out that Xerces-C v3 dropped the DOMBuilder class. The migration archive tells me this:
...一些DOM接口(DOMBuilder,DOMWriter,DOMInputSource等)被替换为最后的DOM Level 3的规格一致性工作的一部分。
...a number of DOM interfaces (DOMBuilder, DOMWriter, DOMInputSource, etc.) were replaced as part of the the final DOM Level 3 specification conformance work.
这很好。但有关于如何迁移code依赖这些类新的API的指南?
That's nice. But is there any guide on how to migrate code that relies on these classes to the new API?
推荐答案
替换:
-
使用
XercesDOMParser
或DOMLSParser
而不是DOMBuilder
(更多信息):
xercesDOMParser-> setCreateCommentNodes(真);
xercesDOMParser->setCreateCommentNodes(true);
使用 DOMLSSerializer
而不是 DOMWriter
:
DOMLSSerializer *作家=((DOMImplementationLS *)参数impl) - > createLSSerializer();
的DOMConfiguration * DC = writer-> getDomConfig();
DC->的setParameter(XMLUni :: fgDOMErrorHandler,的ErrorHandler);
DC->的setParameter(XMLUni :: fgDOMWRTDiscardDefaultContent,真实);
DOMLSSerializer* writer = ((DOMImplementationLS*)impl)->createLSSerializer(); DOMConfiguration* dc = writer->getDomConfig(); dc->setParameter(XMLUni::fgDOMErrorHandler,errorHandler); dc->setParameter(XMLUni::fgDOMWRTDiscardDefaultContent,true);
使用 DOMLSInput
而不是 DOMInputSource
。
另请参阅:
- "Xerces-C++ API Reference 3.1.1"
- "Xerces-C++ API Reference 2.8.0"
这篇关于的Xerces-C:从V2.X迁移到V3.0的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!