W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2001

problems creating documents

From: enrique costa montenegro <kike@atlas.uvigo.es>
Date: Tue, 9 Jan 2001 10:18:21 +0100 (CET)
To: www-dom@w3.org
Message-ID: <Pine.LNX.3.96.1010109100805.31815A-100000@atlas.uvigo.es>

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
	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() );


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");

where clonado is the cloned node

thanks for your help

Received on Tuesday, 9 January 2001 10:47:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:07 UTC