On 2/18/2011 9:08 AM, Martin Elzen wrote:
Hi All.
I’m working on porting some code that compiles fine on an ICU 3.6 /
Xerces 2.7.0 / Xalan 1.10 “base” to an ICU 4.4.4 / Xerces 3.1.1 / Xalan
1.11-daily-build-of-around-7-november base. Unfortunately Xalan code
like the following:
XalanDOMString param_name = pElt->getAttribute(XalanDOMString("name"));
There were a number of APIs on the Xalan DOM that were never used
internally and there were some contortions in the code to support some
of them, so they were removed.
fails to compile with gcc version 4.4.something on Fedora13.
So I diffed that Xalan 1.11 tree against the Xalan 1.10 tree, found some
differences and eventually came up with the following that does compile
for the Xalan 1.11 bits:
XalanNode* pnodeTwo = pElt->getAttributes()->getNamedItem(
XalanDOMString("name") );
XalanDOMString param_name;
if( pnodeTwo )
param_name = pnodeTwo->getNodeValue();
This code is slightly inefficient, as you're making a copy of the
XalanDOMString instance. You could do this as:
const XalanDOMString* param_name = NULL;
if (pnodeTwo) {
param_name = &pnode_two->getNodeValue();
}
if (param_name) {
...
}
Is the above Xalan 1.11-using code correct, though?
Yes, that code is correct, and should also work with earlier versions of
Xalan-C.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org
For additional commands, e-mail: xalan-dev-h...@xml.apache.org