Page 1 of 1
Trouble with Xerces 3.0.1
Posted: Thu Apr 09, 2009 10:23 pm
by d-farrell2
When trying to compile Qbox with xerces 3.0.1 I ran into a few errors.
One was : WavefunctionHandler.C:415: error: invalid conversion from ‘XMLByte**’ to ‘char**’ - easily fixed by editing that line to read 'XMLString::release((char**)&b);'
the second which I am not so sure about is:
WavefunctionHandler.C: In member function ‘virtual void WavefunctionHandler::endElement(const XMLCh*, const XMLCh*, const XMLCh*, std::string&)’:
WavefunctionHandler.C:407: error: no matching function for call to ‘xercesc_3_0::Base64::decode(XMLByte*, unsigned int*)’
/home/defarr/Qbox/xerces-c-3.0.1/include/xercesc/util/Base64.hpp:102: note: candidates are: static XMLByte* xercesc_3_0::Base64::decode(const XMLByte*, XMLSize_t*, xercesc_3_0::MemoryManager*, xercesc_3_0::Base64::Conformance)
/home/defarr/Qbox/xerces-c-3.0.1/include/xercesc/util/Base64.hpp:186: note: static XMLByte* xercesc_3_0::Base64::decode(const XMLByte*, XMLSize_t*, XMLByte*&, xercesc_3_0::MemoryManager*, xercesc_3_0::Base64::Conformance)
make: *** [WavefunctionHandler.o] Error 1
any thoughts?
Re: Trouble with Xerces 3.0.1
Posted: Fri Apr 10, 2009 3:56 pm
by d-farrell2
ok - found my problem is actually nested dependencies in the various libraries linked.
Re: Trouble with Xerces 3.0.1
Posted: Wed Apr 15, 2009 5:25 am
by fgygi
Regarding the first problem: It is interesting that the Xerces API is somewhat inconsistent here. The Base64 class API says that Base64::decode allocates the returned XMLByte buffer and that it should be deallocated using an XMLString member (XMLString::release). In Xerces 2.8.0, XMLString::release(XMLByte** buf) exists, but it has disappeared in Xerces 3.0.1. However, since XMLByte is a typedef for unsigned char, I will assume it is legal to cast XMLByte** to char** which then allows one to use XMLString::release(char** buf), but this is a little weird.
I will schedule the change for inclusion in the next release.
Thanks.
Re: Trouble with Xerces 3.0.1
Posted: Sat Oct 10, 2009 3:54 am
by fgygi
The error reported in the original post can be avoided by replacing WavefunctionHandler.C:407 by the following line:
Code: Select all
XMLByte* b = Base64::decode((XMLByte*) content.c_str(), (XMLSize_t*) &length);
The cast to (XMLSize_t*) is necessary to conform to the 3.0.1 API. However, this makes the code incompatible with Xerces 2.8.0.
This may be a good time to migrate Qbox to Xerces-C 3.0.1, but there is still a fair number of platforms on which we haven't built 3.0.1.
There is at least one platform (TACC Ranger) on which 2.8.0 does not build with g++ 3.4.6, and migration to Xerces 3.0.1 is necessary.
The probable course of action will be an #ifdef ...
Re: Trouble with Xerces 3.0.1
Posted: Thu Dec 09, 2010 12:38 am
by correaa
Hi, any news on this front? as of version 1.52 I still can not use xerces 3. The library still reads negative values for zval and lmax which raise an exception while reading the 'species'.
Re: Trouble with Xerces 3.0.1
Posted: Fri Dec 10, 2010 12:20 am
by fgygi
The problem seems to come from the following change in the Xerces-C 3 API (tested here with Xerces-C 3.1.1).
From the migration guide from 2.8.0 to 3.0.0 on page
http://xerces.apache.org/xerces-c/migra ... fiedAPI300
Many public interfaces that used int/long types to represent memory-related sizes, counts, indexes, etc., have been modified to use the 64-bit safe XMLSize_t type instead
The type of some arguments of the members of SAX2 DefaultHandler have changed. In particular, the "length"
argument in member function ::characters has changed from unsigned int to XMLSize_t.
This affects the following files:
StructuredDocumentHandler.h
StructuredDocumentHandler.C
You can fix it with the following:
Code: Select all
===================================================================
--- StructuredDocumentHandler.C (revision 800)
+++ StructuredDocumentHandler.C (working copy)
@@ -61,7 +61,7 @@
////////////////////////////////////////////////////////////////////////////////
void StructuredDocumentHandler::characters(const XMLCh* const chars,
- const unsigned int length)
+ const XMLSize_t length)
{
#if TIMING
Timer tm;
===================================================================
--- StructuredDocumentHandler.h (revision 800)
+++ StructuredDocumentHandler.h (working copy)
@@ -61,7 +61,7 @@
void startElement(const XMLCh* const uri,const XMLCh* const localname,
const XMLCh* const qname, const Attributes& attributes);
- void characters(const XMLCh* const chars, const unsigned int length);
+ void characters(const XMLCh* const chars, const XMLSize_t length);
void endElement(const XMLCh* const uri, const XMLCh* const localname,
const XMLCh* const qname);
void ignorableWhitespace(const XMLCh* const chars,
===================================================================
--- WavefunctionHandler.C (revision 836)
+++ WavefunctionHandler.C (working copy)
@@ -405,7 +405,7 @@
{
// base64 encoding
unsigned int length;
-#ifdef XERCESC_3_0_1
+#ifdef XERCESC_3
XMLByte* b = Base64::decode((XMLByte*)content.c_str(),
(XMLSize_t*) &length);
#else
Note the change of the test for XERCESC_3_0_1 in WavefunctionHandler.C to XERCESC_3, since the minor versions upgrades are likely not affecting the API.
The above fix was released in 1.52.3. See
http://eslab.ucdavis.edu/software/qbox
Please post to this list if you find more Xerces-C 3 problems.
Thanks