- <?xml version="1.0" encoding="UTF-8"?>
- <ns2:urlset xmlns:ns2="http://www.sitemaps.org/schemas/sitemap/0.9" hc="a3">
- <url>
- <loc>http://www.flipclub.com/</loc>
- <lastmod>2015-06-09</lastmod>
- <changefreq>daily</changefreq>
- <priority>1.0</priority>
- </url>
- <url>
- <loc>http://www.flipclub.com/flashcard/46/3rd-Grade:-Ancient-Rome-Flashcards</loc>
- <lastmod>2015-06-09</lastmod>
- <changefreq>daily</changefreq>
- <priority>1.0</priority>
- </url>
- <url>
- <loc>http://www.flipclub.com/flashcard/47/7th-Grade:-Social-Studies-Flashcards</loc>
- <lastmod>2015-06-09</lastmod>
- <changefreq>daily</changefreq>
- <priority>1.0</priority>
- </url>
- <url>
- <loc>http://www.flipclub.com/flashcard/1068/ACT-English-Game-Set-2-Flashcards</loc>
- <lastmod>2015-06-09</lastmod>
- <changefreq>daily</changefreq>
- <priority>1.0</priority>
- </url>
- <url>
- <loc>http://www.flipclub.com/flashcard/1070/ACT-Exam-Math-Game-Set-1-Flashcards</loc>
- <lastmod>2015-06-09</lastmod>
- <changefreq>daily</changefreq>
- <priority>1.0</priority>
- </url>
- <url>
- <loc>http://www.flipclub.com/flashcard/1069/ACT-Exam-Science-Game-Set-1-Flashcards</loc>
- <lastmod>2015-06-09</lastmod>
- <changefreq>daily</changefreq>
- <priority>1.0</priority>
- </url>
- </ns2:urlset>
http://flipclub.com/
http://flipclub.com/flashcard/46/3rd-Grade:-Ancient-Rome-Flashcards
http://flipclub.com/flashcard/47/7th-Grade:-Social-Studies-Flashcards
http://flipclub.com/flashcard/1068/ACT-English-Game-Set-2-Flashcards
http://flipclub.com/flashcard/1070/ACT-Exam-Math-Game-Set-1-Flashcards
http://flipclub.com/flashcard/1069/ACT-Exam-Science-Game-Set-1-Flashcards
Codes:-
- var url = "http://flipclub.com/sitemap.xml";//get xml from sample sitemap.xml
- var http = require("http");
- var parseString = require('xml2js').parseString;//make sure you have installed xml2js with "npm install xml2js"
- var req = http.get(url, function(res) {
- // save the data
- var xml = '';
- res.on('data', function(chunk) {
- xml += chunk;
- });
- res.on('end', function() {
- parseString(xml, function(err, result) {
- var items = result['ns2:urlset']['url'];
- items.forEach(function(entry) {
- console.log(entry['loc'][0]);
- });
- });
- });
- });
- req.on('error', function(err) {
- // debug
- console.log(err);
- });
No comments:
Post a Comment