Added a special case for '&' when outputting an attribute
value that is a URI in HTML output. Committing the fix for
XALANJ-611
diff --git a/src/org/apache/xml/serializer/ToHTMLStream.java b/src/org/apache/xml/serializer/ToHTMLStream.java
index 600637c..019f362 100644
--- a/src/org/apache/xml/serializer/ToHTMLStream.java
+++ b/src/org/apache/xml/serializer/ToHTMLStream.java
@@ -1312,6 +1312,19 @@
// We now we reset the next possible clean character.
cleanStart = i + 1;
}
+ else if (ch == '&')
+ {
+ // HTML 4.01 reads, "Authors should use "&" (ASCII decimal 38)
+ // instead of "&" to avoid confusion with the beginning of a character
+ // reference (entity reference open delimiter).
+ if (cleanLength > 0)
+ {
+ writer.write(chars, cleanStart, cleanLength);
+ cleanLength = 0;
+ }
+ writer.write("&");
+ cleanStart = i + 1;
+ }
else
{
// no processing for this character, just count how