Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 16th, 2014, 01:09 AM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default small issue creating sitemap.xml usinf ASP

Im using classic ASP to create sitemap.xml files however I am getting a small issue which I cant figure out. My objective is to obey this:

http://www.sitemaps.org/protocol.html

The issue in my output. I can not figure out how to stop the xmlns="" being printed inside the url tag. it should only be showing in the urlset tag

Here is the cut n paste working ASP/VBScript:

Code:
Dim theDom, theRoot, theParent,theChild, theID, docInstruction

Set theDom = Server.CreateObject("Microsoft.XMLDOM")
Set theRoot = theDom.createElement("urlset")

Set theID = theDom.createAttribute("xmlns")
theID.Text = "http://www.sitemaps.org/schemas/sitemap/0.9"
theRoot.setAttributeNode theID
theDom.appendChild theRoot

Set theParent = theDom.createElement("url")     
  Set theChild = theDom.createElement("loc")
  theChild.Text = "http://someURL.com"
  theRoot.appendChild theParent
  theParent.appendChild theChild

  Set theChild = theDom.createElement("changefreq")
  theChild.Text = "weekly"
  theRoot.appendChild theParent
  theParent.appendChild theChild

Set theParent = theDom.createElement("url")     
  Set theChild = theDom.createElement("loc")
  theChild.Text = "http://someOtherUrl.com"
  theRoot.appendChild theParent
  theParent.appendChild theChild

  Set theChild = theDom.createElement("changefreq")
  theChild.Text = "weekly"
  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("MyXMLDoc.xml")
and here is the output of the XML file it creates. How can I stop the xmlns="" from showing in the url tag but make sure it stays in the urlset tag??

Code:
  <?xml version="1.0" encoding="UTF-8" ?> 
 - <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  - <url xmlns="">
     <loc>http://someURL.com</loc> 
     <changefreq>weekly</changefreq> 
    </url>
 - <url xmlns="">
    <loc>http://someOtherUrl.com</loc> 
    <changefreq>weekly</changefreq> 
   </url>
  </urlset>
__________________
Wind is your friend
Matt

Last edited by mat41; April 16th, 2014 at 02:34 AM..
Reply With Quote
  #2 (permalink)  
Old April 22nd, 2014, 05:46 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Matt,

I answered this question here: http://stackoverflow.com/questions/2...15919#23215919

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Small Company Looking for XML Editor Beta Checkers dzrihen XML 0 January 20th, 2011 11:10 AM
Creating a skin file issue bpl BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 October 27th, 2009 07:39 PM
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 05:51 AM
Small issue, someone else may have noticed too mike_remember Forum and Wrox.com Feedback 10 April 4th, 2007 11:53 AM
Creating Dynamic ASP.NET Server Controls Using XML kwilliams XSLT 0 October 6th, 2006 01:42 PM



All times are GMT -4. The time now is 05:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.