Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

HTML Conventions

FJMonteroInformatica6a3f2ee68761
diff --git a/docs/_static/selectors-sample1.html b/docs/_static/selectors-sample1.html
index 8a79a3381..915718832 100644
--- a/docs/_static/selectors-sample1.html
+++ b/docs/_static/selectors-sample1.html
@@ -1,16 +1,17 @@
-<html>
- <head>
- <base href='http://example.com/' />
- <title>Example website</title>
- </head>
- <body>
- <div id='images'>
- <a href='image1.html'>Name: My image 1 <br /><img src='image1_thumb.jpg' /></a>
- <a href='image2.html'>Name: My image 2 <br /><img src='image2_thumb.jpg' /></a>
- <a href='image3.html'>Name: My image 3 <br /><img src='image3_thumb.jpg' /></a>
- <a href='image4.html'>Name: My image 4 <br /><img src='image4_thumb.jpg' /></a>
- <a href='image5.html'>Name: My image 5 <br /><img src='image5_thumb.jpg' /></a>
- </div>
- </body>
-</html>
+<!DOCTYPE html>
+<html>
+ <head>
+ <base href='http://example.com/' />
+ <title>Example website</title>
+ </head>
+ <body>
+ <div id='images'>
+ <a href='image1.html'>Name: My image 1 <br /><img src='image1_thumb.jpg' alt='image1'/></a>
+ <a href='image2.html'>Name: My image 2 <br /><img src='image2_thumb.jpg' alt='image2'/></a>
+ <a href='image3.html'>Name: My image 3 <br /><img src='image3_thumb.jpg' alt='image3'/></a>
+ <a href='image4.html'>Name: My image 4 <br /><img src='image4_thumb.jpg' alt='image4'/></a>
+ <a href='image5.html'>Name: My image 5 <br /><img src='image5_thumb.jpg' alt='image5'/></a>
+ </div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/tests/sample_data/link_extractor/linkextractor.html b/tests/sample_data/link_extractor/linkextractor.html
index 2307ea865..e3a2a4145 100644
--- a/tests/sample_data/link_extractor/linkextractor.html
+++ b/tests/sample_data/link_extractor/linkextractor.html
@@ -1,20 +1,22 @@
+<!DOCTYPE html>
+
<html>
-<head>
-<base href='http://example.com' />
-<title>Sample page with links for testing LinkExtractor</title>
-</head>
-<body>
-<div id='wrapper'>
-<div id='subwrapper'>
-<area href='sample1.html' />
-<a href='sample2.html'>sample 2<img src='sample2.jpg'/></a>
-</div>
-<a href='http://example.com/sample3.html' title='sample 3'>sample 3 text</a>
-<a href='sample3.html'>sample 3 repetition</a>
-<a href='sample3.html#foo'>sample 3 repetition with fragment</a>
-<a href='http://www.google.com/something'></a>
-<a href='http://example.com/innertag.html'><b>inner</b> tag</a>
-<a href=' page 4.html '>href with whitespaces</a>
-</div>
-</body>
-</html>
+ <head>
+ <base href='http://example.com' />
+ <title>Sample page with links for testing LinkExtractor</title>
+ </head>
+ <body>
+ <div id='wrapper'>
+ <div id='subwrapper'>
+ <area href='sample1.html' alt='sample1'/>
+ <a href='sample2.html'>sample 2<img src='sample2.jpg' alt='sample2'/></a>
+ </div>
+ <a href='http://example.com/sample3.html' title='sample 3'>sample 3 text</a>
+ <a href='sample3.html'>sample 3 repetition</a>
+ <a href='sample3.html#foo'>sample 3 repetition with fragment</a>
+ <a href='http://www.google.com/something'></a>
+ <a href='http://example.com/innertag.html'><strong>inner</strong> tag</a>
+ <a href='page 4.html'>href with whitespaces</a>
+ </div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/tests/sample_data/link_extractor/linkextractor_latin1.html b/tests/sample_data/link_extractor/linkextractor_latin1.html
index e7eee18de..1e05bf0f0 100644
--- a/tests/sample_data/link_extractor/linkextractor_latin1.html
+++ b/tests/sample_data/link_extractor/linkextractor_latin1.html
@@ -1,3 +1,5 @@
+<!DOCTYPE html>
+
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=latin-1">
@@ -7,11 +9,11 @@
<body>
<div id='wrapper'>
<div id='subwrapper'>
- <a href='sample_�.html'><img src='sample2.jpg'/></a>
+ <a href='sample_ñ.html'><img src='sample2.jpg' alt='sample2'/></a>
</div>
- <a href='sample_�.html' title='sample �'>sample � text</a>
+ <a href='sample_á.html' title='sample á'>sample á text</a>
<div id='subwrapper2'>
- <a href='sample_�.html?price=�32&�=unit'><img src='sample3.jpg'/></a>
+ <a href='sample_ö.html?price=£32&µ=unit'><img src='sample3.jpg' alt='sample3'/></a>
</div>
</div>
</body>
diff --git a/tests/sample_data/link_extractor/linkextractor_no_href.html b/tests/sample_data/link_extractor/linkextractor_no_href.html
index 0b01cede8..2d67ec6ff 100644
--- a/tests/sample_data/link_extractor/linkextractor_no_href.html
+++ b/tests/sample_data/link_extractor/linkextractor_no_href.html
@@ -1,3 +1,5 @@
+<!DOCTYPE html>
+
<html>
<head>
<base href='http://example.com' />
@@ -21,5 +23,4 @@
</div>
</div>
</body>
-
</html>
\ No newline at end of file
diff --git a/tests/sample_data/link_extractor/linkextractor_noenc.html b/tests/sample_data/link_extractor/linkextractor_noenc.html
index f9166adbe..6fa137cd9 100644
--- a/tests/sample_data/link_extractor/linkextractor_noenc.html
+++ b/tests/sample_data/link_extractor/linkextractor_noenc.html
@@ -1,14 +1,17 @@
+<!DOCTYPE html>
+
<html>
-<head>
-<base href='http://example.com' />
-<title>Sample page without encoding for testing LinkExtractor</title>
-</head>
+ <head>
+ <base href='http://example.com' />
+ <title>Sample page without encoding for testing LinkExtractor</title>
+ </head>
+
<body>
-<div id='wrapper'>
-<div id='subwrapper'>
-<a href='sample_ñ.html'><img src='sample2.jpg'/></a>
-</div>
-<a href='sample_€.html' title='sample €'>sample € text</a>
-</div>
+ <div id='wrapper'>
+ <div id='subwrapper'>
+ <a href='sample_ñ.html'><img src='sample2.jpg' alt='sample2'/></a>
+ </div>
+ <a href='sample_€.html' title='sample €'>sample € text</a>
+ </div>
</body>
</html>
diff --git a/tests/sample_data/test_site/index.html b/tests/sample_data/test_site/index.html
index d268c846a..afe17d8e2 100644
--- a/tests/sample_data/test_site/index.html
+++ b/tests/sample_data/test_site/index.html
@@ -1,18 +1,15 @@
-<html>
-
-<head>
-<title>Scrapy test site</title>
-</head>
-
-<body>
+<!DOCTYPE html>
-<h1>Scrapy test site</h1>
-
-<ul>
-<li><a href="item1.html">Item 1</li>
-<li><a href="item2.html">Item 2</li>
-<li><a href="item999.html">Item 999 (not found)</li>
-</ul>
-
-</body>
-</html>
+<html>
+ <head>
+ <title>Scrapy test site</title>
+ </head>
+ <body>
+ <h1>Scrapy test site</h1>
+ <ul>
+ <li><a href="item1.html">Item 1</a></li>
+ <li><a href="item2.html">Item 2</a></li>
+ <li><a href="item999.html">Item 999 (not found)</a></li>
+ </ul>
+ </body>
+</html>
\ No newline at end of file
diff --git a/tests/sample_data/test_site/item1.html b/tests/sample_data/test_site/item1.html
index ceeb6dc87..ee39f16f3 100644
--- a/tests/sample_data/test_site/item1.html
+++ b/tests/sample_data/test_site/item1.html
@@ -1,17 +1,14 @@
-<html>
-
-<head>
-<title>Item 1 - Scrapy test site</title>
-</head>
-
-<body>
+<!DOCTYPE html>
-<h1>Item 1 name</h1>
-
-<ul>
-<li>Price: $100</li>
-<li>Stock: 12</li>
-</ul>
-
-</body>
+<html>
+ <head>
+ <title>Item 1 - Scrapy test site</title>
+ </head>
+ <body>
+ <h1>Item 1 name</h1>
+ <ul>
+ <li>Price: $100</li>
+ <li>Stock: 12</li>
+ </ul>
+ </body>
</html>
diff --git a/tests/sample_data/test_site/item2.html b/tests/sample_data/test_site/item2.html
index a64c92810..f40f70750 100644
--- a/tests/sample_data/test_site/item2.html
+++ b/tests/sample_data/test_site/item2.html
@@ -1,17 +1,14 @@
-<html>
-
-<head>
-<title>Item 2 - Scrapy test site</title>
-</head>
-
-<body>
+<!DOCTYPE html>
-<h1>Item 2 name</h1>
-
-<ul>
-<li>Price: $200</li>
-<li>Stock: 5</li>
-</ul>
-
-</body>
-</html>
+<html>
+ <head>
+ <title>Item 2 - Scrapy test site</title>
+ </head>
+ <body>
+ <h1>Item 2 name</h1>
+ <ul>
+ <li>Price: $200</li>
+ <li>Stock: 5</li>
+ </ul>
+ </body>
+</html>
\ No newline at end of file