[thelist] XML hierarchical menu

Aaron Boodman aaron at youngpup.net
Fri Sep 6 09:47:01 CDT 2002


> 1) Does this seem a logical way to go about creating what I want?

Well, it would work. Probably not the most efficient or maintainable way.
More on that later.


> does anyone know of an online class
> reference giving me the methods etc. to achieve this? I have googled and
> MS'd already, but haven't been able to locate an exhaustive reference.

you're looking for the msxml sdk
(http://msdn.microsoft.com/library/en-us/xmlsdk/htm/sdk_intro_6g53.asp)
which can also be downloaded as a handy windows help file.

one thing you may want to look into (depending on how much time you have) is
to do this with XSLT
(http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xsl_ref_overview_1vad.as
p). It's alot easier to code, debug, and read. Plus it's cool. You want to
be cool, don't you?

Good luck.

--
Aaron Boodman
aaron | www @ youngpup.net


----- Original Message -----
From: "Chris Marsh" <chris at webbtech.co.uk>
To: <thelist at lists.evolt.org>
Sent: Friday, September 06, 2002 6:07 AM
Subject: [thelist] XML hierarchical menu


> Dear all
>
> Specific questions are at the bottom of the post, after all
> explanations.
>
> I am producing an ASP class that generates a vertical navigation bar.
> Some of the links have sub-sections, and sub-sub-sections. An example
> would be:
>
> <ul>
> <li>
> Link 1
> </li>
> <li>
> Link 2
> <ul>
> <li>
> Sub-link 1
> </li>
> </ul>
> </li>
> </ul>
>
> I want to pull the information for the links from an XML document. An
> example would be:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <wt:menu xmlns:wt="http://www.wt.co.uk">
> <wt:item url="/wt/home.asp">
> Home
> </wt:item>
> <wt:item url="/wt/news.asp">
> News
> </wt:item>
> <wt:item url="/wt/expertise.asp">
> Expertise
> <wt:item url="/wt/expertise/consultancy.asp">
> Consultancy
> </wt:item>
> </wt:item>
> </wt:menu>
>
> I figured that the way to go about formatting this XML into the menu
> system would be something like this (pseudo-code):
>
> Function FormatLink(Value)
> Format into valid HTML
> End Function
>
> Function GetNextLevel(Root_Position)
> Get collection of nodes 1 level down from Root_Position
> For I = 0 To Len(collection of nodes)
> GetNextLevel = GetNextLevel & FormatLink(node(i).Text)
> If node(i) has child nodes
> strSubLevel = GetNextLevel(node(i))
> GetNextLevel = GetNextLevel & strSubLevel
> End If
> Next
> End Function
>
> Function CreateMenu()
> Load XMLdoc
> CreateMenu = GetNextLevel(Root_Position)
> End Function
>
> My questions are as follows:
>
> 1) Does this seem a logical way to go about creating what I want?
>
> 2) If the answer to (1) is "yes", does anyone know of an online class
> reference giving me the methods etc. to achieve this? I have googled and
> MS'd already, but haven't been able to locate an exhaustive reference.
>
> Many thanks in advance
>
> Chris Marsh
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>




More information about the thelist mailing list