Solved

closest method in vb script xml

Posted on 2014-04-19
2
194 Views
Last Modified: 2014-04-21
in vb script is there a way to find the closest instance of a node working up the node tree, similar to closest in jquery.


<xml>
   <outer attr="thisattr">
     <mid>
         <inner>
         <inner>
     </mid>
  </outer>
</xml>

something like this...
foundnode = closest(node, "outer[@thisattr]")

Function closest(node,addr)
' what would go here to find the closest.
'I am thining some sort of do while loop, but don't know
End Function
0
Comment
Question by:KeithMcElroy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 40010990
In vbs, the only thing you can do is find a string, then parse that string as needed or move on.  If you are reading rows, use instr function to find the first occurrence of </inner> then new line starting with <inner>

Otherwise, javascript would be a better fit.  If this is for an asp page, you can run javascript server side (jscript) but it would be a lot faster to just do it clientside.
0
 

Author Comment

by:KeithMcElroy
ID: 40011930
so i can't use the xmldom?  I know some about the xmldom, but am stuck on how to use it to bubble up and find the first instance.  I was hoping someone might know how to write a loop that would stop when it finds the matching node.  Will give it a day in case any answers come in; if not will award points.  The jscript idea might help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question