data presented in HTML format and submitted to server, that does some preprocessing.
It operates with "src" attribute of "img" tag.
After preprocessing and saving, all the preprocessed "img" tags are not self-closed.
For example, if "img" tag was following:
<img src="image.png" />
after preprocessing with Nokogiri or Hpricot, it will be:
<img src="/preprocessed_path/image.png">
The code is pretty simple:
doc = Hpricot(self.content)
doc.search("img").each do |tag|
preprocess tag
end
self.content = doc.to_html
For Nokorigi, it looks the same.
How to resolve this issue ?
Update 1
Forget to mention - i have HTML 5 page, which i'm trying to validate with W3C Validator.
When "img" tag is inside a div, it complaints about following:
required character (found d) (expected i)
</div>
For example, try to validate following code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
</head>
<body>
<div>
<img src="image.png">
</div>
</body>
</html>
You will get the same error:
Line 9, Column 4: required character (found d) (expected i)
</div>