WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

System_XML

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

SelectNodes

 Keywords: XML SelectNode SelectNodes Select Node System.Xml System.Xml.XmlDocument

;***************************************************************************
;**   XML SelectNode
;**
;** Purpose: Selects a list of nodes matching the XPath expression.
;** Inputs:
;** Outputs: Results displayed in a message
;** Reference:
;**       REQUIRES WinBatch 2013A or newer
;**
;** Developer: Deana Falk 2014.04.14
;***************************************************************************
If Version( )< '2013A'
   Pause('Notice', 'Need 2013A or Newer Version of WinBatch')
   Exit
EndIf

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Load assemblies into the WinBatch process.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ObjectClrOption( 'use', 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' )

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Prompt for input
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strxml =        '<Names>':@LF
strxml = strxml:'   <Name type="M">John</Name>':@LF
strxml = strxml:'   <Name type="F">Susan</Name>':@LF
strxml = strxml:'   <Name type="M">David</Name>':@LF
strxml = strxml:'</Names>':@LF

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Create a class implemented by a managed assembly.
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
doc = ObjectClrNew( 'System.Xml.XmlDocument' )
doc.LoadXml( strxml )
xnList = doc.SelectNodes("/Names/Name[@type='M']");
ForEach xn In xnList
   xn = ObjectClrType( 'System.Xml.XmlNode', xn )
  Pause('',xn.InnerText);
Next
Exit

Article ID:   W17852
Filename:   SelectNode.txt
File Created: 2014:04:14:09:29:18
Last Updated: 2014:04:14:09:29:18