Trouble traversing xml tree with xpath -


i have legacy xml used create navigation area of website:

<?xml version="1.0" encoding="utf-8"?> <menu>     <menuitem>         <name>about</name>         <id>1</id>         <link>/about/index.html</link>         <menuitem>             <name>vision</name>             <id>1.1</id>             <link>/about/vision.html</link>         </menuitem>         <menuitem>         <name>history</name>             <id>1.2</id>             <link>/about/history.html</link>             <menuitem>                 <name>relocation</name>                 <id>1.2.1</id>                 <link>/about/relocation.html</link>             </menuitem>         </menuitem>     </menuitem> </menu> 

the website built in classic asp have tried use xpath render out navigation:

dim objxml, strleftnav set objxml = server.createobject("msxml2.domdocument.4.0") objxml.async=false objxml.load("nav.xml") if objxml.parseerror.errorcode = 0     dim xmlnode     each xmlnode in objxml.selectnodes("*/menuitem/*")         set xmlnamenode = xmlnode.selectsinglenode("//menu/menuitem/name")         strleftnav = strleftnav & "<li>" & xmlnamenode.nodetypedvalue & "</li>"     next     set xmlnamenode = nothing end if set objxml = nothing response.write("<ul>" & strleftnav & "</ul>") 

this leaves me number of li showing first name node 'about' trying pull out name node each menuitem node list, can advise me correct xpath syntax?

the xpath expression //menu/menuitem/name absolute selection starting root of tree. want select relative current position, might name. haven't made clear how want handle recursive structure of input xml, it's not clear output want.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -