[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] Document comments
- From: Daniel Veillard <veillard redhat com>
- To: Bjorn Reese <breese mail1 stofanet dk>
- Cc: "xml gnome org" <xml gnome org>
- Subject: Re: [xml] Document comments
- Date: Wed, 9 Apr 2003 11:53:13 -0400
On Wed, Apr 09, 2003 at 01:57:53PM +0000, Bjorn Reese wrote:
> Daniel Veillard wrote:
>
> > xmlAddChild((xmlNodePtr) doc, comment)
> > those kind of operations work on the common part of the node structures.
>
> Is this an officially endorsed practice? I mainly ask, because I feel
> reluctant about casting between two conceptually different structs.
On a case by case basis yes, I do taht a lot in the code. The structures
(except xmlNs nodes) share a header part used for navigation and linking.
> > >>> doc.addChild(comment)
> [...]
> > >>> root.addPrevSibling(comment)
>
> I got both to work by upgrading to the latest libxml2 version.
> Sorry about that.
heh ...
> > > > xmlDocSetRootElement() is more expected to be used for elements nodes
> > > > for example it will wipe out the old root if it already exists.
> > >
> > > I fail to see the purpose of xmlNewDocComment() then.
> >
> > I don't see the link between your sentence and mine ...
>
> Well, at the time of writing, the only possibility I could see
> for adding a document comment was to use xmlDocSetRootElement().
> If that function only was intended to set the actual root element,
yup,
> and not to add document comments as well, then I had difficulty
> understanding why xmlNewDocComment() was needed at all. That is,
> why have a special function for this, rather than just using
> xmlNewComment()? I guess, that question is not relevant after
> all.
Well xmlNewDocComment() is really xmlNewComment() but with the
doc link of the returned object preinitialized.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]