Experiment: xerces-c2.x and xerces-c3.x programming differences __ Programming

Source: Internet
Author: User

Requirements: the example works that can be found now, most of which are xerces-c2.x, have many of these practical projects, and xerces-c3.x performance is better.

In order to upgrade xerces-c2.x to xerces-c3.x, or from the xerces-c2.x project on-demand extraction function to xerces-c3.x, the problem is xerces-c2.x source Engineering in the xerces-c3.x compiled but.

Workaround:

I experimented with upgrading 2 xerces-c2.x projects to xerces-c3.x, which has been successful. Find some difference.

My application is XML read and write, as long as you can complete these two basic operations.

The reason for the discovery is that Domwriter does not exist in 3.x and is replaced by a domlsserializer of similar functionality. I tried to change it, and the code churn was small. The function is normal after compiling.

The difference between the last project discovery and this similar, and so on later encountered in addition.

<! internal_domwriter* Theserializer = getdomimplementation ()->createdomwriter ();!>//DOMLSSerializer * Theserializer = ((domimplementationls*) impl)->createlsserializer ();!>//internal_domwriter* TheSerializer = Getdomimplementation ()->createdomwriter ();!> xerces_cpp_namespace_qualifier DOMLSSerializer * TheSerializer = ((Xerces_cpp_namespace_qualifier domimplementationls*) getdomimplementation ())->createlsserializer ();

<! Const tchar* BUF = theserializer->writetostring ((internal_node&) *xmldoc);!>//const tchar* buf = Theserializer->writetostring ((internal_node&) *xmldoc);!> const tchar* BUF = theserializer-> Writetostring ((Xerces_cpp_namespace_qualifier domnode*) doc->getdocumentelement ());!>

Now the internet out of the xerces-c3.1.1 with the demo, have not seen the release of the demo. I'm going to release a xerces-3.1.1 demo~ first.

Perhaps the engineer on CodeProject, think everybody should all should extrapolate ~

When the project is a multibyte character set, the string conversion

/** * Xmlch * and PCHAR conversion * * * #define XC (str) xmlstring::transcode (str) #define CX (str) xmlstring::transcode (str, XMLPLATFO Rmutils::fgmemorymanager)

The project has been completed and I have modified a project on the CodeProject.

http://download.csdn.net/source/2943125
XmlEditor Modified version _v2010_1228_0117

Software Description:

<2010_1228_0108>Function:
XML file editor, node additions and deletions. All operations on XML are included. can be derived from many of our own practical applications.

Note:
This example is based on xercesc2.x, but is compiled under xercesc3.x.
It is a Unicode version and is now converted to a multibyte version.
The accompanying Xerces-c_3_1.dll is also compiled into a multibyte version. Xerces-c_3_1_1 itself works, I did not join this project, too big.
The project is with xerces-c_3.1.1. Lib,. Dll, *.HPP

I have not found a project demo based on xerces-c_3.1.1 on the internet up to 2010_1228_0108. I don't know if I was the first one to release this demo coder Ah ~
Did not put on the CodeProject, want to contact the author himself, let him upgrade his demo to xerces-c_3.1.1.

The XML operation in this demo is very complete, and I will then refine and encapsulate the XML operation from this demo.

<2011_0126>

The author himself does not upgrade, and he thinks his demo is designed to show the development of a generic xmlparser with design patterns.

According to the application of the project, I have sealed several functions, which can conveniently take the text content of the node and the attribute value of the node.

It is now normal to load XML content from a file.

We are now addressing the problem of loading xmlbuffer with memory, and colleagues are implemented in 2.x and compiled on 3.1.1.

The example Memparse in 3.1.1 shows the xmlbuffer that is loaded with the analysis by memory. By stripping out the required functionality, you can solve the problem of parsing XML character streams.

<2011_0127>

Today, the reason that VC6 cannot use xerces-c-3.1.1 is validated./zc:wchar_t-is used even when compiling xerces-c-3.1.1 in vs2008. The resulting DLL cannot be compiled by VC6. And vs2008 can be programmed into vs2008-generated DLLs.

Vs2008:treat wchar_t as built-in Type:no (/zc:wchar_t-)
VC6: There is no reason to use xerces-c-3.1.1 and the new Boost library without this option

VC6 to do the formal project development tools, is really useless ...

There are 2 ways to solve the problem now:

1. Upgrade existing VC6 works to VS2008 (why not upgrade to VS2010?) Because the existing free interface library on hand is only supported to vs2008~.

2. Use the old version of the xerces-c2.x library.

Colleagues tend to use Method 2, Pau High, save time.

When you are ready to use the new boost library after a year, you have to use VS2008, the original project code with VC6 does not amount to the interface provided by colleagues. Upgrades are relatively easy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.