Я вынужден работать в классическом ASP для старого проекта, который нуждается в обновлении.
Мне нужно создать карту сайта с этой схемой:
<url>
<loc>URL_BASE</loc>
<lastmod>DATE</lastmod>
<xhtml:link rel="alternate" hreflang="it" href="URL_IT"/>
<xhtml:link rel="alternate" hreflang="en" href="URL_EN"/>
</url>
Я нашел скрипт asp, который создает простой файл sitemap.xml, но более простой, без "lastmod" и альтернативных URL.
Dim theDom, theRoot, theParent,theChild, theID, docInstruction
const NODE_ELEMENT = 1
const xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9"
Set theDom = Server.CreateObject("Microsoft.XMLDOM")
Set theRoot = theDom.createElement("urlset")
Set theID = theDom.createAttribute("xmlns")
theID.Text = xmlNs
theRoot.setAttributeNode theID
theDom.appendChild theRoot
Set theParent = theDom.createNode(NODE_ELEMENT, "url", xmlns)
Set theChild = theDom.createNode(NODE_ELEMENT, "loc", xmlns)
theChild.Text = "http://someURL.com"
theRoot.appendChild theParent
theParent.appendChild theChild
Set docInstruction = theDom.createProcessingInstruction("xml","version='1.0' encoding='UTF-8'")
theDom.insertBefore docInstruction, theDom.childNodes(0)
theDom.Save Server.MapPath("sitemap.xml")
Есть способ создать XML-файл, подобный схеме, которая мне нужна?
Я пытался выяснить, как это сделать, но безуспешно.
Спасибо за любую помощь.