Missing href attribute handling

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Missing href attribute handling

kkrugler
Hi Jukka,

Previously the HtmlParser code (or rather, HtmlHandler) would ensure  
that there was always an href attribute for an <a> tag - if it was  
missing, it would get set to "".

The new code no longer does this, which caused some of my code to fail.

I see the new code looks like:

                 String href = atts.getValue("href");
                 if (href != null) {
                     xhtml.startElement("a", "href",  
resolve(href.trim()));
                 } else {
                     String anchor = atts.getValue("name");
                     if (anchor != null) {
                         xhtml.startElement("a", "name", anchor.trim());
                     } else {
                         xhtml.startElement("a");
                     }
                 }

I'm assuming this is by design, though for XHTML the use of "name" is  
deprecated, with "id" being its replacement.

-- Ken


--------------------------------------------
Ken Krugler
+1 530-210-6378
http://bixolabs.com
e l a s t i c   w e b   m i n i n g