Answer the question
In order to leave comments, you need to log in
How to get data from sitemap.xml?
There is an xml file where the data is located as follows:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>http://site.ru</loc>
</url>
</urlset>
Answer the question
In order to leave comments, you need to log in
Taking into account the tags of the question, I will answer:
Select site.ru with the mouse and press ctrl + c.
And so, they can offer to either pull out a regular expression (in the end, there will be something like /^<loc>(.*?)<\/loc>/
) Or, more correctly, use DOM parsers.
No language was specified, so here's PHP:
php.net/manual/ru/book.simplexml.php
Here's ruby:
www.nokogiri.org
Python:
https://docs.python.org/2/library/xml.etree. elements...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question