[jdom-interest] (new subscriber) JDOMException: Invalid Unicode character (0x0)

James Scott jscott at hnt.com
Sat Mar 10 13:57:08 PST 2001


Hi all-

I always hate to include a problem in my first post to a list, but my back's
against the wall. I'm retrieving an XML-format string from Oracle's Internet
File System (IFS) and passing it to a SAXBuilder to create a Document type. When
I do this, the SAXBuilder throws the folowing exception:

org.jdom.JDOMException: Error on line 14: An invalid XML character (Unicode:
0x0) was found in the element content of the document.

The document in question is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:template match="/">
<html>
<head>
  <title>Portal example</title>
</head>
<body>
<H1>For you, we have some portlets.</H1>
<xsl:apply-templates match="portlets"/>
</body>
</html>
</xsl:template>

As the file is only 14 lines long, I assume that it's some kind of problem with
the end-of-file or end-of-string marker. A little net.research led me to believe
that it might be a UTF-8 vs. UTF-16 problem, but I can't get around it by
constructing a new String(oldString.getBytes, "UTF8").

Thanks in advance for any help you might be able to provide. Until this, I've
had a great experience with JDOM, and I'm sure I'm missing something obvious.

JLS



More information about the jdom-interest mailing list