[jdom-interest] JDOM parsing of XHTML document

Eric Ace ace at rdacorp.com
Wed Feb 13 17:57:31 PST 2002


All,

I have an XHTML file. I load it into a JDOM Document object and then just display it using the following code:

	 
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(new File("test-xhtml.html"));
fmt.output(doc, System.out);
	 
The output has the <td> tags modified to specify rowspan & colspan attributes - these were not present in the input. Is this supposed to be? Can this behavior be overridden? Thanks.
	 
INPUT FILE (test-xhtml.html) :
==============================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html 
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Virtual Library</title>
</head>
<body>
<table border="1" name="testtbl" id="testtbl">
<thead>
<tr><td>HD1</td><td>HD2</td><td>HD3</td><td>HD4</td></tr>
</thead>
<tbody>
<tr><td>R3C1</td><td>R3C2</td><td>R3C3</td><td>R3C4</td></tr>
</tbody>
</table>
</body>
</html>
	 
OUTPUT:
=======================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Virtual Library</title>
</head>
<body>
<table border="1" name="testtbl" id="testtbl">
<thead>
<tr><td rowspan="1" colspan="1">HD1</td><td rowspan="1" colspan="1">HD2</td><td rowspan="1" colspan="1">HD3</td><td rowspan="1" colspan="1">HD4</td></tr>
</thead>
<tbody>
<tr><td rowspan="1" colspan="1">R1C1</td><td rowspan="1" colspan="1">R1C2</td><td rowspan="1" colspan="1">R1C3</td><td rowspan="1" colspan="1">R1C4</td></tr>
</tbody>
</table>
</body>
</html>





More information about the jdom-interest mailing list