lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Unit test not passing with libxml++


From: Greg Chicares
Subject: Re: [lmi] Unit test not passing with libxml++
Date: Mon, 16 Oct 2006 12:35:48 +0000
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

On 2006-10-15 23:55 UTC, Evgeniy Tarassov wrote:
> 
> There was also an issue with libxml++ putting a default empty value ""
> as xml document encoding which is not allowed. Fixed it by putting
> "utf-8" as a default encoding and commited into the same branch.

Does that mean you have found a defect in libxml++?

Here's your change:

--- lmi/lmi/Attic/xml_lmi.cpp   2006/10/15 17:15:44     1.1.2.1
+++ lmi/lmi/Attic/xml_lmi.cpp   2006/10/15 23:29:43     1.1.2.2
[...]
 std::ostream & operator << ( std::ostream & os, Document & document )
 {
-    document.write_to_stream( os );
+    document.write_to_stream( os, "utf-8" );
     return os;
 }

But the libxml++ documentation seems to suggest that utf-8 is
already the default, in which case your patch should have no
effect:

http://libxmlplusplus.sourceforge.net/docs/reference/1.0/html/classxmlpp_1_1Document.html

| void xmlpp::Document::write_to_stream (std::ostream & output,
|   const std::string & encoding = std::string()
|  )
[...]
| encoding If not provided, UTF-8 is used
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The comment says "UTF-8 is used" by default, but the default
argument in the declaration is an empty string.

Yet that comment definitely seems to be wrong. To test it, I
temporarily reverted your patch in my local tree, and indeed
the defect you had fixed then reappeared: files saved without
your patch cannot be reloaded, because they have
  <?xml version="1.0" encoding=""?>
, but they can be reloaded if I manually edit them and change
the first line to
  <?xml version="1.0" encoding="utf-8"?>
.

So I suspect that this is a real defect in libxml++. I don't
find it in their bugzilla:
  http://bugzilla.gnome.org/buglist.cgi?query=write_to_stream





reply via email to

[Prev in Thread] Current Thread [Next in Thread]