W3C home > Mailing lists > Public > html-tidy@w3.org > January to March 2003

Re: update content of a node : tidylib

From: Charles Reitzel <creitzel@rcn.com>
Date: Mon, 17 Feb 2003 11:38:18 -0500
Message-Id: <>
To: "Renjith K.V" <renjith@iceindia.com>
Cc: html-tidy@w3.org

Hi Renjith,

Sorry to be a drag, but you are better off discussing the internal APIs on 
the developer list.  Also, please be aware that the internal APIs are not 
supported.  Meaning there is just a few of us working on the project and we 
split our time between actual development work and helping folks like yourself.

That said, the short answer about how to update nodes would be to look at 
ParseSelect() in parser.c.  The other things to keep in mind are that 
_text_ _node_ contents (hint #1) are kept in the Lexer buffer (hint #2).

Try this: fire up an un-modified tidylib and have it parse some markup with 
a SELECT element.  Have a look at the tree structure produced and what text 
is individually allocated (e.g. w/ tmbstrdup) or kept in the Lexer buffer.


At 03:44 PM 2/17/2003 +0530, Renjith K.V wrote:

>How to i update content of a node programatically with tidylib
>( This is for adding more items to combo boxes in html
>    my program added <option> node to select node. but i need to set 
> content of <option> tag
>   <option name = "contry"></option> should be made <option name = 
> "contry">India</option>
>I have added a node to Html DOM in following way
>Also i need to update content of the Option  tag.
>         if(tidyNodeIsSELECT(child))
>           {
>                 AttVal *av;
>                 optNode = InferredTag( tdoc, "Option");
>                 av = NewAttribute();
>                 av->attribute = tmbstrdup("value");
>                 av->value = tmbstrdup("test");
>                 optNode->attributes = av;
>                 InsertNodeAtEnd(child, optNode);
>         }
>how can i do that ?
>I have tried the following way but it gives me errors
>optNode->type == TextNode;
>optNode->content = tmbstrdup("oho whatz it ?");
>please help me
Received on Monday, 17 February 2003 11:29:08 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:53 UTC