Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2006, 06:48 PM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SiteMap Problems

I have been playing around with making a sitemap and have run into a problem. This is the error that I get when I try to run the site.

Exactly one <siteMapNode> element is required directly inside the <siteMap> element.

Here is a basic sitemap that I have ben playing with

<?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>
    <siteMapNode url="default1.aspx" title="Home1" description="Home1"></siteMapNode>
</siteMap>

Any ideas what I am doing wrong?
 
Old March 27th, 2006, 01:17 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think what the error message is saying is that you need one, and only one "root" node, that in turn can have multiple sub nodes. Right now, your sitemap defines two siteMapNodes that server as the root, which is not OK.

Nest each subsequent element in the first "Home" element:
Code:
<?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="default1.aspx" title="Home1"    
            description="Home1"></siteMapNode>
      <siteMapNode url="default2.aspx" title="Home1"    
            description="Home2"></siteMapNode>
    </siteMapNode>
</siteMap>
HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old September 5th, 2006, 12:31 AM
Registered User
 
Join Date: Aug 2006
Location: Auckland, , New Zealand.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The siteMap remind me of the navigation used in Microsoft UIP (Ages ago) . “siteMap” should have only one <siteMap> node. And one and only main <siteMapNode>. That doesn’t mean you cant group your child pages to a logical <siteMapNode>. Its best to show a proper example. Make sure to have the “url” attribute unique. That will be the internal unique identifier. Have a look at the bellowing sample.

<?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="The default page" >
      <siteMapNode url= "ManageStock/Default.aspx" title="Home2" description="The default page" >
        <siteMapNode url="ManageStock/Page1.aspx" title="Run1" description="another page"/>
        <siteMapNode url="ManageStock/Page2.aspx" title="Run2" description="another page"/>
      </siteMapNode>

      <siteMapNode url= "BuyStock/Default.aspx" title="Home3" description="The default page" >
        <siteMapNode url="BuyStock/Page1.aspx" title="Run1" description="another page"/>
        <siteMapNode url="BuyStock/Page2.aspx" title="Run2" description="another page"/>
      </siteMapNode>
    </siteMapNode>
  </siteMap>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Sitemap melania ASP.NET 3.5 Basics 0 October 27th, 2008 01:20 PM
web.sitemap workidoo BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 June 13th, 2008 08:42 AM
Sitemap Problems mattid ASP.NET 2.0 Basics 1 May 29th, 2006 01:13 AM
chapter 3 sitemap try it out diango BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 January 16th, 2006 11:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.