Hi,
Is there any method which will replace the title of the page with new one.
if (node instanceof TitleTag)
{
TitleTag titleTag = (TitleTag) node;
TitleTag startTitleNode = new TitleTag();
TextNode textNode = new TextNode("Title");
TextNode endTitleNode = new TextNode("</TITLE>");
saveDataList.add(startTitleNode);
saveDataList.add(textNode);
saveDataList.add(endTitleNode);
This code creates a new title! but the previous text tag in title remains intact...
Please help me.
Thanks in advance
-Amod
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The only way that you can get that combined title is if you are adding the new text to the existing children node list.
Replacing the child list in the title tag should do it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Is there any method which will replace the title of the page with new one.
if (node instanceof TitleTag)
{
TitleTag titleTag = (TitleTag) node;
TitleTag startTitleNode = new TitleTag();
TextNode textNode = new TextNode("Title");
TextNode endTitleNode = new TextNode("</TITLE>");
saveDataList.add(startTitleNode);
saveDataList.add(textNode);
saveDataList.add(endTitleNode);
This code creates a new title! but the previous text tag in title remains intact...
Please help me.
Thanks in advance
-Amod
I think you want:
...
TitleTag titleTag = (TitleTag) node;
titleTag.setChildren (new NodeList (new TextNode ("The New Title")));
...
Hi,
When I tried with the above mentioed code, this is how the new title tag looks like....
<title>The new title
Tomcat WebDAV support
</title>
</head>
<body bgcolor="#FFFFFF">
<img SRC="tomcat.gif" height=92 width=130 align=LEFT>
<b>
where I want the page title to be....
<title>The new title</title>. (i.e I want to replace the string "Tomcat WebDAV support" with "The new title".)
Could you please help me?
Thanks in advance!!!!!
-Amod
The only way that you can get that combined title is if you are adding the new text to the existing children node list.
Replacing the child list in the title tag should do it.