Mark wrote:
I've just started using Xerces and I'm using SAX2XMLReader to parse a ~250MB xml file. In the startElement function of my content handler I need to compare localname e.g. if (localname == "something"). I know I can't use == but I can't figure out what to use. Can anyone point me in the right direction?
This is probably the most-asked question on the list, so you can search the archives for XMLString::transcode() to find lots of information.

The most efficient thing to do is to construct static strings at compile time, if you can. Take a look at the constants in src/xercesc/util/XMLUni.cpp for some examples.

The next most efficient thing to do, if you will only know the set of strings you're looking for at run-time, is to use a local code page transcoder to convert your strings from the local code page to UTF-16 strings. For that, you can use one of the overloads of XMLString::transcode(). Once you've done that, you can use XMLString::equals().

Dave

Reply via email to