Hi,

Can someone tell me how to insert a comment node to a nsITextContent.?


I tried the following

// create comment as shown
nsAutoString str,comment,value;
comment.Assign(NS_LITERAL_STRING("<!-- PAGE BREAK -->"));
nsCOMPtr<nsIContent> text;
NS_NewCommentNode(getter_AddRefs(text),nsnull);
nsCOMPtr<nsIDOMNode> commentNode = do_QueryInterface(text);
commentNode->SetNodeValue(str);

//Tried this  - way 1
 nsCOMPtr<nsIDOMNode> node = do_QueryInterface(cont);
 node->GetNodeValue(value);
 value.Append(comment);
 node->SetNodeValue(value);

//Tried this -  way 2
cont->AppendChildTo(text)

Way 2 : Did not work.

Way 1 : gets set as  &lt; PAGE BREAK &gt;

regards,
Krithika

_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to