Re: [xml] Query about xmlNewReference
- From: Daniel Veillard <veillard redhat com>
- To: Ashwin <ashwins huawei com>
- Cc: xml gnome org, ranjit huawei com, nageshs huawei com
- Subject: Re: [xml] Query about xmlNewReference
- Date: Wed, 27 Aug 2008 14:22:41 +0200
On Mon, Jun 23, 2008 at 11:51:59AM +0800, Ashwin wrote:
In the function xmlNewReference for the following bit of code
[...]
Or should the the line be
cur->children = ent->children?
No that's fine you want to a pointer to the entity
(see xmllint --debug test/ent1)
Hi,
I still have a lingering doubt about the above, consider the example of
the attached file. The subtree of the entity reference node for &Fname;
consists of seven children.
This is because the child node of ent ref node &Fname; points to the Entity
Decl node Fname, hence effectively if try to get the child nodes of ent ref
node &Fname; we get 7 children.
Should not the child node of ent-ref node be a text node containing the
replacement text of the entity rather than the entire tree associated with
the corresponding entity declaration?
Old email, I double-checked
I still think that's fine, we are marking ent as the last children too
(gdb) n
2577 cur->children = (xmlNodePtr) ent;
(gdb) n
2578 cur->last = (xmlNodePtr) ent;
So yes in a sense we reference a long list, but we provide the
correct boundaries there. When looking at an entity reference children
(i.e. assuming no entity substitution) the current node dow not 'own'
the children, we just indicate (as much as possible) what nodes are
concerned by the entity value, they are the sub-list between children
and last.
For references those pointers have a slightly different semantic.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]