Solved

closest method in vb script xml

Posted on 2014-04-19
2
190 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 52

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Which free XML software can I use for opening and editing an XML file? 15 117
Vb.net XML Read all nodes and 4 100
Insert Powershell variable into XML 4 53
XML SQL 8 27
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 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