Re: [Libxmlplusplus-general] write() broken, maybe fixed



On Mon, 2002-12-16 at 11:35, Christophe de VIENNE wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Le Lundi 16 Décembre 2002 10:27, Murray Cumming a écrit :
> > The change to Node::write() just before the 0.17 release broke that
> > method, leading to segfaults in some situations, and at least not
> > writing out all child nodes in the dom_build example.
> 
> Well, I've just tried this and had no problems. The output is the same as the 
> source file, except for the namespace which is removed.

That's not what I saw. I guess I could download the release and
double-check.

> I did the change to Node::write() because the output was different.

Yes, but the change was more than what you described in the ChangeLog.
That fix is still there.

> The segfault happen when the incoming node tree is incorrect (a text node with 
> children).

I don't see how that is possible. It's impossible to write such an XML
file, even by hand.

> Running the example with this patch and writing the resulting tree to a new 
> file, I've something like :

>       1 <?xml version="1.0"?>
>       2 <Helping>
>       3   <Jobs>
>       4     <Job>
>       5       <Project ID="3"/>
>       6       <Application>
>       7         <text>GBackup</text>
>       8       </Application>
>       9       <Category>
>      10         <text>Development</text>
>      11       </Category>
>      12       <Update>
>      13         <Status>
>      14           <text>Open</text>
>      15         </Status>
>      16         <Modified>
>      17           <text>Mon, 07 Jun 1999 20:27:45 -0400 MET DST</text>
>      18         </Modified>
>      19         <Salary>
> [...]

The problem here seems to be only when writing stuctures that have been
read in by libxml++ itself. Maybe you should add or modify an example to
do this, so we will know if it works.

I think the problem here is that we are adding text nodes as regular
nodes instead of justing using xmlNodeSetContent(). Can't we just check
for node->type == XML_TEXT_NODE before adding it in write()?

I think we really should use the libxml functions instead of modifying
the structs directly.

-- 
Murray Cumming
murray usa net
www.murrayc.com





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