P
pwaring
I'm trying to use JTidy (latest release version, I can't use the svn
version) to pretty print a Node (org.w3c.dom.Node). However, the only
method for printing nodes in org.w3c.tidy.Tidy is:
public void pprint(org.w3c.dom.Document doc, java.iutputStream out)
So I need to create a Document containing only one node so that I can
pass it as an argument to this method Does anyone know how I can do
this? I've tried a simple cast (which doesn't work), and creating an
empty document then adding a node to it with the following code:
try
{
content.appendChild(currentDiv);
}
catch ( DOMException dome )
{
System.out.println("Error: " + dome.getMessage());
}
However, this throws an exception with the message: "Error: newChild
cannot be a child of this node". Does anyone know how/if I can get
round this? It seems like an awful lot of hassle just to print a Node.
Thanks in advance,
Paul
version) to pretty print a Node (org.w3c.dom.Node). However, the only
method for printing nodes in org.w3c.tidy.Tidy is:
public void pprint(org.w3c.dom.Document doc, java.iutputStream out)
So I need to create a Document containing only one node so that I can
pass it as an argument to this method Does anyone know how I can do
this? I've tried a simple cast (which doesn't work), and creating an
empty document then adding a node to it with the following code:
try
{
content.appendChild(currentDiv);
}
catch ( DOMException dome )
{
System.out.println("Error: " + dome.getMessage());
}
However, this throws an exception with the message: "Error: newChild
cannot be a child of this node". Does anyone know how/if I can get
round this? It seems like an awful lot of hassle just to print a Node.
Thanks in advance,
Paul