开发者

Xerces-C: Migration from v2.x to v3.x?

开发者 https://www.devze.com 2023-01-15 06:11 出处:网络
I would like to migrate a project (legacy code which I am not quite familiar with) from Xerces-C v2.x to v3.x.

I would like to migrate a project (legacy code which I am not quite familiar with) from Xerces-C v2.x to v3.x.

It turns out that Xerces-C v3 dropped the DOMBuilder class. The migration archive tells me this:

...a number of DOM interfaces (DOMBuilder, DOMWriter, DOMInputSource, etc.) were replaced as part of the the final DOM Level 3 specification conformance work.

That's nice. But is there any guide on how to migrate code that relies on thes开发者_StackOverflowe classes to the new API?


Replacements for removed APIs:

  • Use XercesDOMParser or DOMLSParser instead of DOMBuilder (more info):

    xercesDOMParser->setCreateCommentNodes(true);

  • Use DOMLSSerializer instead of DOMWriter:

    DOMLSSerializer* writer = ((DOMImplementationLS*)impl)->createLSSerializer(); DOMConfiguration* dc = writer->getDomConfig(); dc->setParameter(XMLUni::fgDOMErrorHandler,errorHandler); dc->setParameter(XMLUni::fgDOMWRTDiscardDefaultContent,true);

  • Use DOMLSInput instead of DOMInputSource.

See also:

  • "Xerces-C++ API Reference 3.1.1"
  • "Xerces-C++ API Reference 2.8.0"
0

精彩评论

暂无评论...
验证码 换一张
取 消