[jdom-interest] SAXBuilder revealing SaxParserException - cause unknown
Willie H Armstrong
warmstr2 at csc.com
Thu Jan 22 16:53:29 PST 2004
Greetings all,
While attempting to build a JDOM Document I am receiving a
SAXParserException with a detailMessage stating "The string "--" is not
permitted within comments." I have examined the input stream and can only
find '--' in the comment tag start and stops, '<!--' and '-->'. The
exception reports a line and column location. When the location is examined
in a programming editor, UltraEdit, the specified point looks the same in
UTF, Unicode and ASCII encodings. The area (formatted) on the input stream
is as follows. The **** marks where the SAXParserException says the parsing
failed.
<script language="JavaScript">
<!-- function adDigit(num) {
var sinDig = new String();
if (num <= 9) {sinDig = "0" + num};
else {sinDig = num}
return sinDig;
}
var expdt = new String("2004-01-30T18:00:00");
var effdt = new
String("2004-01-22T13:07:04");
var today = new Date();
var dtd =
new Date****();
var dt = new String();
dtd =
(today.getMonth()+1);
dtd = adDigit(dtd);
today =
today.getYear()+"-"+(adDigit(today.getMonth()+1))+"-"+(adDigit(today.getDate()))+"T"+(adDigit(today.getHours()))+":"+(adDigit(today.getMinutes()))+":"+(adDigit(today.getSeconds()));
if (today <= expdt && today >= effdt) {
document.write("<img
src='/livelinksupport/xsl/newsstand/resources/images/bullet_text.gif'/> <a
href='?func=ll&objId=2099235&objAction=viewnews'>Needham Weight Loss
Program</a>") }
if (expdt == "") {
document.write("<img
src='/livelinksupport/xsl/newsstand/resources/images/bullet_text.gif'/> <a
href='?func=ll&objId=2099235&objAction=viewnews'>Needham Weight Loss
Program</a>") }
--></script>
I am using the Oracle JDeveloper 10g IDE. I have replaced the Oracle V2
parser with the Apache Xerces 2_6_0. The parsing exception is thrown on
line 370 of SAXBuilder. I have verified that both the parser and in objects
are not null and are of the expected class.
369 // Parse the document.
370 parser.parse(in);
371
372 return contentHandler.getDocument();
The build method is being called in this piece of my code, where isIn is an
InputStream.
SAXBuilder builder = new SAXBuilder();
builder.setValidation(false);
builder.setIgnoringElementContentWhitespace(false);
try {
doc = builder.build(isIn);
} catch (JDOMException e) {
throw new FailedTransformException(
"Could not build internal JDOM document.");
}
The input stream starts with this piece of XML. The input stream is from a
HttpsUrlConnection.
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:mydt="urn:lldtfun">
<head>
Your guidance and assistance is requested and appreciated. If more
information is needed, please let me know.
Thank you,
Bill
More information about the jdom-interest
mailing list