Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

closest method in vb script xml

Posted on 2014-04-19
2
Medium Priority
?
198 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
2 Comments
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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. 
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

963 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