[xsd-users] validating expat parser fails
Boris Kolpackov
boris at codesynthesis.com
Fri Sep 26 02:58:40 EDT 2014
Hi Ovanes,
Ovanes Markarian <om_codesynthesis at keywallet.com> writes:
> Yes, and it still breaks...
You tried with optimization disables completely (no -O option of any
kind), right?
> Unfortunately, this is the reason, why I use clang on linux. GCC just
> crashes with that many templates and C++11 features :( I last time
> tried it with GCC 4.9.0
It is hard for me to believe that (fairly old) Clang 3.3 works better
than (the very recent) GCC 4.9.0.
> > 3. Upgrade to more recent clang and try to build with address sanitizer.
>
> Mmm.. That's sounds strange how address sanitizer is going to fix it.
As I said, I can see two possibilities for the cause of this bug:
1. Bug in XSD. In this case it is most likely some data is placed in
the wrong place in a buffer or some such. The address sanitizer
can help detect such bugs.
2. Bug in Clang (or its standard C++ library). In this case upgrading
to the latest version is the easiest way to test it.
> I have no crashes etc. It is just an exception that states, that '1002' is
> not valid. This is also the ID which is in XML. I saw the code which does
> the conversion it is doing it via iostream or at least stream like
> interface. How do you parse the numbers.
With iostream. If you can step through the code, you can try to see
exactly why it is failing (e.g., stream returned an error, stream not
exhausted, something else).
Could also be a difference in the standard library. Are you using
libstdc++ or libc++?
> May be a small offtopic, but wouldn't be parsing XML like types with
> Boost Karma a faster approach.
Maybe. But we cannot introduce a dependency on Boost.
> Additionally, I had initially in schema xs:integer as the type and in
> http://www.w3schools.com/schema/schema_dtypes_numeric.asp is stated that
> xs:integer is some integral value, somewhere else I saw that
> 0000000000003333330303003004505055 is a valid value. Would the current
> stream based conversion be able to convert it?
No, if you use xs:integer and the actual value doesn't fit into long long,
then it will not work. If you need to handle such large integers, then
you can map xs:integer to your custom arbitrary-length integer type,
implement custom parser/serializer, and it will work.
Boris
More information about the xsd-users
mailing list