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



Le Lundi 16 Décembre 2002 14:54, Murray Cumming a écrit :
> On Mon, 2002-12-16 at 15:18, Christophe de VIENNE wrote:
> > May I ask you how did you add the content to your nodes in your app ?
> > using add_content or set_content ? In the later case this accessor should
> > be used only on the text node itself, not on it's parent. And this could
> > explain how could some nodes have both a non empty _content and some
> > children.
>
> I didn't know that we had add_content(). It seems to add a name-less
> child node. I don't know why we have it. set_content() seems clear
> enough. Note that I use set_content() in

At least we now know why we don't anderstand each other...

>
> Until we have some concept of text nodes I don't think we should demand
> that people know what is a text node.

agree.

> Ideally we wouldn't return text nodes from children(),

ideally yes. The current behavior is a unhappy compromise which leads to 
confusions. It's one of the reason I wanted to change all of this.

> because we store child text nodes as _content anyway.

no. The _content attribute is used only in text nodes, and it has always been 
like this in libxml++. That's why I don't want to change it only for one 
version before the API change.
Note that I completely agree with the fact that it is very unclear.

> But it's not worth worrying about because we'll fix the bigger
> problem soon anyway.

yes. By the way, I want to warn people waiting for these changes that I have a 
lack of time this week and next one. So the next release shouldn't happen 
before beginning of january. I'll keep you informed anyway, as I may ask some 
feedback on certain

>
> I have downloaded the 0.17.0 release and repeated the test:
>
> [root localhost dom_build]# ./example
> XML built at runtime:
> <?xml version="1.0"?>
> <!DOCTYPE example_xml_doc PUBLIC "" "example_xml_doc.dtd">
> <exampleroot>Some content<examplechild id="2"/></exampleroot>
>
> That shows no <child_of_child> node.

yes. I did not see that before. The reason is the following :
     48     nodeChild->set_content("Some content");
     49
     50     nodeChild->add_child("child_of_child");

A single node is having both some content and some children. This is not 
valid. The behavior is undetermined, which is the only real problem.

>
> I don't think that it's very useful to parse the output of the
> dom_parser example because that seems to write the text content out
> twice. That's not a big problem - it's not part of the API.

I don't anderstand what you mean. The output is important : it shows that if 
we read then write a single file several times is will create useless nodes 
each time...

>
>
> I am using libxml 2.4.30 from cvs, but I doubt that it makes any
> difference:

neither I do.



If you don't mind, we'll go back on your last change on node.cc, and correct 
the dom_build example.
Since we didn't do any big changes since the last release, we can do a 0.17.1 
version release including the fix.


Best regards,

Christophe








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