Starting my Sitemap from Scratch
- I am trying to start my sitemap from scratch - the reason for doing so is to learn how. I have seen free online services to do it for you but I would rather learn the skill.
Using an example from a sample site that came on a disk when I bought Expression Web 2 Step by Step:
I currently have this:<?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="" title="" description=""> <siteMapNode url="test.aspx" title="Home" description="Home Page" /> <siteMapNode url="DotNetVersion/products/default.aspx" title="Products" description="Our Products" > <siteMapNode url="DotNetVersion/products/product1.aspx" title="Product 1" description="" /> <siteMapNode url="DotNetVersion/products/product2.aspx" title="Product 2" description="" /> <siteMapNode url="DotNetVersion/products/product3.aspx" title="Product 3" description="" /> </siteMapNode> <siteMapNode url="DotNetVersion/services/default.aspx" title="Services" description="Our Services" > <siteMapNode url="DotNetVersion/services/service1.aspx" title="Service 1" description="" /> <siteMapNode url="DotNetVersion/services/service2.aspx" title="Service 2" description="" /> <siteMapNode url="DotNetVersion/services/service3.aspx" title="Service 3" description="" /> </siteMapNode> <siteMapNode url="DotNetVersion/about/default.aspx" title="About Us" description="About Our Company" > <siteMapNode url="DotNetVersion/about/staff.aspx" title="Our Staff" description="" /> <siteMapNode url="DotNetVersion/about/leadership.aspx" title="Company Leadership" description="" /> <siteMapNode url="DotNetVersion/about/awards.aspx" title="Our Awards" description="" /> </siteMapNode> <siteMapNode url="DotNetVersion/news/default.aspx" title="News" description="Company News" /> <siteMapNode url="DotNetVersion/contact/default.aspx" title="Contact Us" description="Contact Us" /> <siteMapNode url="newlink.aspx" title="My New Link" description="Just Added" /> </siteMapNode> </siteMap>
I then put up a site map path using my code and recieved the following error when previewed:<?xml version="1.0" encoding="utf-8" ?> <siteMap>xmlns="<strong>unknown url</strong>"</siteMap> <siteMapNode url="<strong>default.aspx</strong>" title="<strong>Home</strong>" description="<strong>Home</strong>"/> <siteMapNode url="default.aspx" title="Welcome to AquariumProOnline.com!" description="Home" /> </siteMapNode> </siteMap>
Server Error in '/AquariumProOnline' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The XML sitemap config file web.sitemap could not be loaded. There are multiple root elements. Line 3, position 3.
Source Error:
Line 1: <?xml version="1.0" encoding="utf-8" ?> Line 2: <siteMap>xmlns="unknown url"</siteMap> Line 3: <siteMapNode url="default.aspx" title="Home" description="Home"/> Line 4: <siteMapNode url="default.aspx" title="Welcome to AquariumProOnline.com!" description="Home" /> Line 5: </siteMapNode>
Source File: F:\Websites\AquariumProOnline\web.sitemap Line: 3
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
Unfortunately, the site is local, and wont be up untill i figure some of this out. Can someone point me in the right direction with my sitemap? Here is an outline of how my site will be structured (not every single page located below)
Site Map
About
Product Reviews
Aeration
Aquariums & Accessories
Aquariums
Accessories
Cleaning
Controllers & Monitors
Controllers
Monitors
Feeding
Filters
Canister Filters
Internal Filters
Other Filters
Power Filters
Heaters & Chillers
Chillers
Heaters
Lighting
Power Heads
Pumps
Purification
Testing Equipment
Ultra-Violet Sterilizers
Columns
Chris Gelner
Articles
Beginner
Intermediate
Expert
Informational
Contact
Please point me in the right direction, or point out what other information you need. I find XML to be incredibly easy to learn, i LOVE the AdRotator control. Once I get rolling with it I will likely pick up the pattern.
Thanks in advance guys and gals!
-Nate
All Replies
- Hate to say it, and you're going to kick yourself, but the error is pointing to the exact right spot.
What you have on the first line is:
<siteMap>xmlns="<strong>unknown url</strong>"</siteMap>
Notice how there's a </siteMap> there? It shouldn't be. All your sitemap nodes need to be contained between a <sitemap> and a </sitemap>
So, instead of <siteMap>xmlns="unknown url"</siteMap>
try this: <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
or simply <siteMap>
after your very last </sitemapnode>, put a </siteMap>
You should end up with something like:
<siteMap>
<siteMapNode url="default.aspx" title="Home" desciption="Home" />
<siteMapNode url="default.aspx" title="Welcome to AquariumProOnline.com!" description="Home" />
</siteMapNode>
</siteMap> - Here is what I have:
This is the error returned:<?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"> <siteMapNode url="default.aspx" title="Home" description="Home"/> <siteMapNode url="default.aspx" title="Welcome to AquariumProOnline.com!" description="Home" /> </siteMapNode> </siteMap>
Server Error in '/AquariumProOnline' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The XML sitemap config file web.sitemap could not be loaded. The 'siteMap' start tag on line 2 does not match the end tag of 'siteMapNode'. Line 5, position 3.
Source Error:
Line 3: <siteMapNode url="default.aspx" title="Home" description="Home"/> Line 4: <siteMapNode url="default.aspx" title="Welcome to AquariumProOnline.com!" description="Home" /> Line 5: </siteMapNode> Line 6: </siteMap>
Source File: F:\Websites\AquariumProOnline\web.sitemap Line: 5
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
I removed all indents from the sitemap file. Was this as you intended when you supplied a code when you gave your example?
Also, on line two I have:
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
Is that the correct link or do i need to find my own?
Thanks in advance.
-Nate - Look at your web.config file and match all the starting and ending tags. The error will become obvious.
The <siteMap> node must be closed at the end of the sitemap by a closing tag: </siteMap> So far so good.
Each <siteMapNode> must be self closed: <siteMapNode stuffhere />, or, typically when there are nested nodes, closed by a closing tag: </siteMapNode>
You have an extra </siteMapNode> - I have modified my sitemap as follows:
My web.config is as follows:<?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"/> <siteMapNode url="default.aspx" title="Welcome to AquariumProOnline.com!" description="Home" /> </siteMap>
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> </system.web> </configuration>
I am now returning this error:
Server Error in '/AquariumProOnline' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The XML sitemap config file web.sitemap could not be loaded. There are multiple root elements. Line 3, position 3.
Source Error:
Line 1: <?xml version="1.0" encoding="utf-8" ?> Line 2: <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"/> Line 3: <siteMapNode url="default.aspx" title="Welcome to AquariumProOnline.com!" description="Home" /> Line 4: </siteMap>
Source File: F:\Websites\AquariumProOnline\web.sitemap Line: 3
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
When you say match the start and end tags in web.config, do you mean make sure they all open and close proplerly, or somehow integrate them into the sitemap?
Thanks
-Nate - You're still not matching tags. Every tag must be closed properly. Just look at the formation of your XML.
Example:
<root>
<node1>
</node1>
</root>
See how each tag is closed: Opening tag <root> is closed by the closing </root> tag which contains a tag called node1 (both opening and closing)
Step back and read up on XML over at W3schools.com:
http://www.w3schools.com/xml/default.asp
--
Chris Hanscom - Microsoft MVP
On Facebook | On Twitter | Resource Center | Veign's Blog | Web Development Help
Get a Complete Website Analysis by Veign - After some research, I think i have a general concept on the way a sitemap is structured. According to what I have found, I have constructed this new sitemap:
I do not have all pages built yet, I have incorporated all of what is done here. However I am confronted with this error when I preview:<?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="" title="" description=""> <siteMapNode url="default.aspx" title="Home" description="Welcome to AquariumProOnline.com!" /> </siteMapNode> <siteMapNode url="advertise.aspx" tile="Advertise" description="Advertise on AquariumProOnline.com" /> </siteMapNode> <siteMapNode url="contact.aspx" title="Contact" description="Contact AquariumProOnline.com" /> </siteMapNode> <siteMapNode url="sitemap.aspx" title="Site Map" description="AquariumProOnline.com Site Map" /> </siteMapNode> <siteMapNode url="sponsors.aspx" title="Sponsors of AquariumProOnline.com" /> </siteMapNode> </siteMap>
Server Error in '/AquariumProOnline' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The XML sitemap config file web.sitemap could not be loaded. The 'siteMap' start tag on line 2 does not match the end tag of 'siteMapNode'. Line 7, position 3.
Source Error:
Line 5: </siteMapNode> Line 6: <siteMapNode url="advertise.aspx" tile="Advertise" description="Advertise on AquariumProOnline.com" /> Line 7: </siteMapNode> Line 8: <siteMapNode url="contact.aspx" title="Contact" description="Contact AquariumProOnline.com" /> Line 9: </siteMapNode>
Source File: F:\Websites\AquariumProOnline\web.sitemap Line: 7
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
However, this error does not make sense. The tag it refers to in line 2 is the required opener, and the tag in line 7 is what trips me up. According to what I have found on example site maps, what I have is an exact copy, only modified to fit my site. Can you point out what I am doing wrong? - Dude, go read up on XML. You're just trying random things without knowledge. You're still wrong and its the same problem everyone has been trying to tell you.
What more do you want from us? Same problem, same response every time.
--
Chris Hanscom - Microsoft MVP
On Facebook | On Twitter | Resource Center | Veign's Blog | Web Development Help
Get a Complete Website Analysis by Veign - Okay, now if I back out to try this later, I get an error that indicates that something is still needed to refer to web.sitemap even though the ASP.net control that I was experimenting with is long gone. I spent 2 days perfecting this master page. What can I do now, in order to not have to completely start over?
- I don't follow. Your problem is with the structure of your xml. You need a basic understanding of XML (specifically closing tags, nesting tags and self-closing tags). Once you do that you'll be able to see the problems in your sitemap, and thus, generate a properly formed sitemap.
--
Chris Hanscom - Microsoft MVP
On Facebook | On Twitter | Resource Center | Veign's Blog | Web Development Help
Get a Complete Website Analysis by Veign - Ok. But for now, i want to continue on with building other pages, I want to get rid of the navigation element right now untill i understand it more. However, when I delete this element, save, and preview, the browser returns the error provided above.
At this point, I do not want to deal with the sitemap or the navigation control, I can do without for now. However, after i delete the control, save the master page, preview my homepage, it is like i never deleted the navigation control, therefore all i get is the error, i cannot view the webpages at all.
How do I get out of this mess? - My stubborness kicks me once again. I figured out the problem. It is working now - imagine that. I read up on it, and voila! It works! Thanks so much. It would have been easier had i read up the first time eh?
- You think :-). Glad you got it working.
--
Chris Hanscom - Microsoft MVP
On Facebook | On Twitter | Resource Center | Veign's Blog | Web Development Help
Get a Complete Website Analysis by Veign My stubborness kicks me once again. I figured out the problem. It is working now - imagine that. I read up on it, and voila! It works! Thanks so much. It would have been easier had i read up the first time eh?
Ain't that always the way? <vbg />
MS MVP Expression Tutorials & Help http://by-expression.com and online instructor led Expression Classes

