Is adding attributes to nodes in the web.sitmap a bad idea?
-
03-07-2019 - |
Question
I using SiteMapPath with an xml file for data. I would like to use the same file for another menu, but I need to have more information attached to each node.
<siteMapNode target="_blank" url="~/Default.aspx" title="Home" description="Home Page" >
VS
<siteMapNode url="~/Default.aspx" title="Home" description="Home Page" >
So far it doesn't break on my box, but will I run into problems later? Or is there a better way?
Solution
Doubtfull you'll run into any problems. Whatever is consuming your sitemap file is only going to parse known attributes. Extra attributes will go ignored.
OTHER TIPS
I use this approach quite often and for quite some time. It has not caused me any problems. The only downside is the code needed to parse them.
I agree with the other answers. XML is meant to be eXtensible.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow