- From: enrique costa montenegro <kike@atlas.uvigo.es>
- Date: Tue, 9 Jan 2001 10:18:21 +0100 (CET)
- To: www-dom@w3.org
hi
ill try to explain my problem. i use org.w3c.dom amd jtidy
i first use jtidy with a html file to create a xml file, with this one i
create a dom
in this dom there will be some nodes and its children that i need to move
to html files. and
then create a new html file without the previous nodes and its children,
and instead a node with a reference to the html files
so here are my two problems:
a) i arrive to a node that i need to convert in a new html file. so i
clone that node, delete its children, replace that node with a node with a
"a" tag, a "href" and a text_node as child. but when i want to pass the
dom to the html file that text node wont appear, so i dont have a place to
click to follow the link :(
here its the code
Element sustituto=document_cuerpo.createElement("a");
Text texto_sustituto=document_cuerpo.createTextNode("LINK");
//replazo el antiguo
try
{
NodeList hijitos =hijos.item(i).getChildNodes();
if (hijitos != null)
{
int camadita=hijitos.getLength();
for (int j= 0; j<camadita; j++)
{
hijos.item(i).removeChild( hijitos.item(j) );
}
}
node.replaceChild(sustituto, hijos.item(i));
}
catch (DOMException e)
{
System.out.println(this.toString() + e.toString() );
return;
}
hijos.item(i).appendChild(texto_sustituto);
b) with the node cloned from the a problem i try to create a new html. so
i create a new document and try to append it, but i wont :(
here is the code
Document document_temp=tidy.createEmptyDocument();
Element element_temp=document_temp.getDocumentElement();
//le pongo cuerpo
Element cuerpo=document_temp.createElement("body");
cuerpo.appendChild(clonado);
element_temp.appendChild(cuerpo);
where clonado is the cloned node
thanks for your help
kike
Received on Tuesday, 9 January 2001 10:47:45 UTC