Hi Dean,

How's your son doing ? He was just a wee wee guy "walking" around the
neighborhood last time I was in town.

Thanks for the code to do the looping.
It works fine !!!

I was curious how use the importNode method which seems to be designed
for this.
When I used the importNode the resulting submenu xml had the 
unwanted element:  <subMenu> as the top element but I only wanted
<menuitem> nodes which I could easily append to the root node <menu>.

I changed the original code so I don't have the importNode version handy.

I will try and followup on the other groups later.

Thanks, Paul


On 7/19/05, Charles Carroll <[EMAIL PROTECTED]> wrote:
> CrossPost this to:
> http://groups.yahoo.com/group/XmlToughQuestionsAspClassicAspNet/
> and
> http://groups.yahoo.com/group/DotNetXML/
> tons of XML experts there may have suggestions to improve that code.
> 
> On 7/18/05, Paul N. Chu <[EMAIL PROTECTED]> wrote:
> >  Here's is the basic code I have so far:
> >
> >  '-- Build Top Full Horizontal Menu at Menu1 server control
> >  Dim menuXML As New System.Xml.XmlDocument
> >  Dim xmlNode As System.Xml.XmlNode
> >  menuXML.Load(Server.MapPath("CoStar.xml"))  ' the Menu file
> >  Menu1.DataSource = menuXML
> >  Menu1.DataBind()  ' Top Horiz Menu built
> >
> >  '-- Build SubMenu Menu at Menu2 server control
> >  Dim xmlSubMenu As XmlDocument = New XmlDocument
> >  Dim xmlDeclaration As XmlDeclaration =
> >  xmlDoc.CreateXmlDeclaration("1.0", "utf-8", Nothing)
> >  Dim rootNode As XmlElement = xmlDoc.CreateElement("Menu")
> >  xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement)
> >  xmlDoc.AppendChild(rootNode)
> >
> >  Dim strMenuItemText As String = "Settlement" '-- Hardcoded here
> >  Dim myXPath As String =
> >  String.Format("/menu/menuItem[text='{0}']/subMenu",
> > strMenuItemText)
> >
> >  'this should point to subMenu node for Settlement menuitem if the
> >  Xpath is right
> >  xmlNode = menuXML.SelectSingleNode(myXPath)
> >
> >  ' ??? How to collect all the childNodes and copy to new document
> >  '  xmlNode.childNodes loop ? with appendChild etc ?
> >
> >  Menu2.DataSource = xmlSubMenu
> >  Menu2.DataBind()
> >
> >
> >
> >  On 7/18/05, Paul N. Chu <[EMAIL PROTECTED]> wrote:
> >  > Given the following xml , I would like to XPATH for the Placement or
> >  > Settlement  menuitem and then construct another XML file shown below
> >  > from the childnodes of the subMenu node.
> >  >
> >  > <menu>
> >  > <menuItem>
> >  >  <text>Placement</text>
> >  >  <cssclass>highlighteditem</cssclass>
> >  >  <subMenu>
> >  >        <menuItem>
> >  >        <text>Sub Item 3</text>
> >  >        <url>page3.html</url>
> >  >        </menuItem>
> >  >        <menuItem>
> >  >        <text>Sub Item 4</text>
> >  >        <url>page4.html</url>
> >  >        </menuItem>
> >  >  </subMenu>
> >  > </menuItem>
> >  >
> >  > <menuItem>
> >  > <text>Settlement</text>
> >  > <cssclass>highlighteditem</cssclass>
> >  >        <subMenu>
> >  >                <menuItem>
> >  >                <text>Sub Item 3</text>
> >  >                <url>page3.html</url>
> >  >                </menuItem>
> >  >                <menuItem>
> >  >                <text>Sub Item 4</text>
> >  >                <url>page4.html</url>
> >  >                </menuItem>
> >  >        </subMenu>
> >  > </menuItem>
> >  > </menu>
> >  >
> >  >
> >  > This is the desired submenu xml that I would like to create:
> >  >
> >  > <menu>
> >  >        <menuItem>
> >  >        <text>Sub Item 3</text>
> >  >        <url>page3.html</url>
> >  >        </menuItem>
> >  >        <menuItem>
> >  >        <text>Sub Item 4</text>
> >  >        <url>page4.html</url>
> >  >        </menuItem>
> >  > </menu>
> >  >
> >  > Thanks, Paul
> >  >
> >  > On 7/18/05, getsmartpaul86 <[EMAIL PROTECTED]> wrote:
> >  > > Hi Xmlers,
> >  > >
> >  > > I'm looking for an example that would
> >  > > use xpath to search a document for a Node and then
> >  > > clone / copy that node and it's children to another xmldocument.
> >  > >
> >  > > I'm working with skmMenu by Scott Mitchell and have a Horizontal Top
> >  > > Menu and would like to search the menu xml nodes to find
> >  > > the current Top Level Menu and copy it's children
> >  > > and then show those nodes also in a left hand - navigation menu.
> >  > >
> >  > > Thus if the  top menu has   CatA , CatB, CatC
> >  > > then the xpath to CatB
> >  > > would find all the childnodes of CatB and then copy them
> >  > > to a new XML document.
> >  > >
> >  > > Thanks for your help, Paul
> >  > >
> >  > >
> >  > >
> >  > >
> >  > >
> >  > >
> >  > >
> >  > > Yahoo! Groups Links
> >  > >
> >  > >
> >  > >
> >  > >
> >  > >
> >  > >
> >  > >
> >  >
> >
> >
> >
> >  ________________________________
> >  YAHOO! GROUPS LINKS
> >
> >
> >  Visit your group "AspNetAnyQuestionIsOk" on the web.
> >
> >  To unsubscribe from this group, send an email to:
> >  [EMAIL PROTECTED]
> >
> >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> >
> >  ________________________________
> >
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
>


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to