p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 (http://p2p.wrox.com/forumdisplay.php?f=389)
-   -   web.sitemap (http://p2p.wrox.com/showthread.php?t=68786)

workidoo June 13th, 2008 08:17 AM

web.sitemap
 
Hello again :)

Have a small problem, or an issue. [:I]

It is so that I tested web.sitemap to create menu that you explain in the book. And everything works perfectly what I have a problem with is that when I want to add more siteMapNode.

I have the following error "Exactly one <siteMapNode> elements required immediately inside the element <siteMap>." What this may be due to? I make no changes in MenuWrapper <div> I let it be as it is, in the book.

This is how my code look like:




<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/" title="Home" description="Home">
    <siteMapNode url="~/Default.aspx" title="Home" description="Go to the homepage" />
    <siteMapNode url="~/Reviews/Default.aspx" title="Reviews" description="Rewievs published on this site">
      <siteMapNode url="~/Reviews/AllByGenre.aspx" title="By Genre" description="All Rewievs Grouped by Genre" />
      <siteMapNode url="~/Reviews/All.aspx" title="All Reviews" description="All Rewievs" />
  </siteMapNode>
  <siteMapNode url="~/About/Default.aspx" title="About" description="About this site">
    <siteMapNode url="~/About/Contact.aspx" title="Contact Us" description="Contact Us" />
    <siteMapNode url="~/About/AboutUs.aspx" title="About Us" description="About Us" />
  </siteMapNode>
  <siteMapNode url="~/Login.aspx" title="Login" description="Log in to this web site" />
  </siteMapNode>
  <siteMapNode url="~/TestAbout/Default.aspx" title="Test About" description="About this site">
    <siteMapNode url="~/TestAbout/Contact.aspx" title="Test Contact Us" description="Contact Us" />
    <siteMapNode url="~/TestAbout/AboutUs.aspx" title="Test About Us" description="About Us" />
  </siteMapNode>
</siteMap>




http://www.workidoo.com

Imar June 13th, 2008 08:27 AM

Hi there,

As the error message explains (which is also explained in the book) you can only have one root element. In your case, Home is the single root element, so you can't add Test About as a second root element. Move Test About into the Home element and the error goes away:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="~/" title="Home" description="Home">
        <siteMapNode url="~/Default.aspx" title="Home" description="Go to the homepage" />
        <siteMapNode url="~/Reviews/Default.aspx" title="Reviews" description="Rewievs published on this site">
            <siteMapNode url="~/Reviews/AllByGenre.aspx" title="By Genre" description="All Rewievs Grouped by Genre" />
            <siteMapNode url="~/Reviews/All.aspx" title="All Reviews" description="All Rewievs" />
        </siteMapNode>
        <siteMapNode url="~/About/Default.aspx" title="About" description="About this site">
            <siteMapNode url="~/About/Contact.aspx" title="Contact Us" description="Contact Us" />
            <siteMapNode url="~/About/AboutUs.aspx" title="About Us" description="About Us" />
        </siteMapNode>
        <siteMapNode url="~/Login.aspx" title="Login" description="Log in to this web site" />
        <siteMapNode url="~/TestAbout/Default.aspx" title="Test About" description="About this site">
            <siteMapNode url="~/TestAbout/Contact.aspx" title="Test Contact Us" description="Contact Us" />
            <siteMapNode url="~/TestAbout/AboutUs.aspx" title="Test About Us" description="About Us" />
        </siteMapNode>
    </siteMapNode>
</siteMap>

Hope this helps,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

workidoo June 13th, 2008 08:42 AM

Thank you, it works now. Sometimes it makes me blind. [8D]

http://www.workidoo.com


All times are GMT -4. The time now is 12:14 PM.

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