logo       

[HtmlUnit] v1.8 problem with HtmlElement.constants and <img src> tags: msg#00031

java.htmlunit.devel

Subject: [HtmlUnit] v1.8 problem with HtmlElement.constants and <img src> tags

I'm using the page.getAllHtmlChildElements() iterator and I'm looking for <img> tags on a given page. I was assuming that this the code below would catch any undefined, or empty src attributes for the img tag.

if(element.getTagName().equalsIgnoreCase("img") &&
element.getAttributeValue("src")!=HtmlElement.ATTRIBUTE_NOT_DEFINED &&
element.getAttributeValue("src")!=HtmlElement.ATTRIBUTE_VALUE_EMPTY)

Here is a snipped of HTML code that is getting past my if statement.

<html>
<head>
<title><img src>This has an unmatched open tag.</title>
</head>
<body>
This is a body.
</body>
</html>

If I do a element.asXml() on the <img src> tag, it is parsed as <img src="">.

Thanks,

Rick


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise