I don't understand what's going on. I
use Ubuntu 12.04. I downloaded
http://ftp.gnome.org/pub/GNOME/sources/libxml++/2.34/libxml++-2.34.2.tar.bz2
ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz
built and installed in /opt/gnome/. I compiled the modified
dom_parser/main.cc against these versions of libxml2 and libxml++.
(I had to remove the call
parser.set_throw_messages(throw_messages) because
xmlpp::Parser::set_throw_messages() does not exist in libxml++
2.34.2.)
And the result? No errors when I validate your xml file against
your dtd file!
If I replace your xsbase.dtd with an empty file, I get the same
validity errors as you got.
Right now I don't know how to proceed. It's difficult to
troubleshoot, when I can't reproduce the error. If I get a new
bright idea, I'll make more tests.
Btw xmllint does not care which dtd file is specified in the xml
file. It uses the dtd file specified on the command line, even if
it's not the same as in the xml file. I think xmllint does not
parse and validate at one go, as xmlpp::DomParser::parse_stream()
does, but parses and validates in two (or possibly more) calls to
different libxml2 functions.
Kjell
2012-10-04 13:00, Sanne Graaf skrev:
I made the exact same changes to the
example as you did (as shown below) and now our outcome is
actually different, I do get the errors that I complained about
in the first place:
./a.out -v msg.txt
Read file:
<?xml version="1.0"?><!DOCTYPE XSBASE SYSTEM
"xsbase.dtd"><XSBASE><Command
type="Connect"/></XSBASE>*
Exception caught: Validity error:
No declaration for attribute type of element Command
No declaration for element Command
No declaration for element XSBASE
The version outputs are:
[sanne@millaray ~]$ pkg-config --modversion libxml++-2.6
2.34.2
[sanne@millaray ~]$ pkg-config --modversion libxml-2.0
2.7.8
It is a stock Fedora 16 system, using these RPM's:
[sanne@millaray ~]$ rpm -qa|grep libxml2
libxml2-2.7.8-8.fc16.i686
libxml2-python-2.7.8-8.fc16.i686
libxml2-devel-2.7.8-8.fc16.i686
[sanne@millaray ~]$ rpm -qa|grep libxml++
libxml++-doc-2.34.2-1.fc16.noarch
libxml++-2.34.2-1.fc16.i686
libxml++-devel-2.34.2-1.fc16.i686
Again, these errors were NOT occurring some time ago, I just
picked up development a couple of day ago on this project. And I
was confronted with these errors, a short investigation of my
system showed me that (in the yum.log) libxml2 was updated:
Sep 27 13:17:39 Updated: libxml2-2.7.8-8.fc16.i686
Sep 27 13:17:41 Updated: libxml2-devel-2.7.8-8.fc16.i686
Sep 27 13:17:52 Updated: libxml2-python-2.7.8-8.fc16.i686
I assume from version *-7, but I am not sure what version was
installed before.
I send you the two input files I use (msg.txt and xsbase.dtd),
direct.
Regards,
Sanne van der Graaf.