[Info-vax] DCL and scripting
Dave Froble
davef at tsoft-inc.com
Wed Dec 12 23:32:23 EST 2018
On 12/12/2018 9:16 PM, Arne Vajhøj wrote:
> On 12/12/2018 8:58 PM, Arne Vajhøj wrote:
>> On 12/12/2018 8:34 PM, Dave Froble wrote:
>>> On 12/12/2018 7:49 PM, Arne Vajhøj wrote:
>>>> Regex is a bit cryptic. But it can be useful.
>>>>
>>>> But I will say that all programmers should know SQL, regex and XPath.
>>>
>>> I know some SQL. I don't even know what regex and xpath is.
>>
>> regex is a way to find patterns in text.
>>
>> XPath is a way to select parts of an XML document.
>>
>>> I guess
>>> according to you I should stick to flying. Oh well, much more fun
>>> anyway.
>>>
>>> Now if it would just warm up ....
>>
>> Or maybe something to study during Christmas vacation.
>>
>> :-)
>
> Simple XPath example in VB.NET:
>
> Imports System
> Imports System.Xml
>
> Namespace DF2
> Public Class Program
> Public Shared Sub Main(args As String())
> Dim xml As String = "<all>" & vbCrLf & _
> " <one>" & vbCrLf & _
> " <a id=""1""/>" & vbCrLf & _
> " <b>A</b>" & vbCrLf & _
> " </one>" & vbCrLf & _
> " <one>" & vbCrLf & _
> " <a id=""2""/>" & vbCrLf & _
> " <b>BB</b>" & vbCrLf & _
> " </one>" & vbCrLf & _
> " <one>" & vbCrLf & _
> " <a id=""3""/>" & vbCrLf & _
> " <b>CCC</b>" & vbCrLf & _
> " </one>" & vbCrLf & _
> "</all>"
> Console.WriteLine(xml)
> Dim doc As New XmlDocument()
> doc.LoadXml(xml)
> For Each n As XmlNode In doc.SelectNodes("/all/one")
> Console.WriteLine(n.SelectSingleNode("a/@id").Value & "
> " & n.SelectSingleNode("b/text()").Value)
> Next
> End Sub
> End Class
> End Namespace
>
> Output:
>
> <all>
> <one>
> <a id="1"/>
> <b>A</b>
> </one>
> <one>
> <a id="2"/>
> <b>BB</b>
> </one>
> <one>
> <a id="3"/>
> <b>CCC</b>
> </one>
> </all>
> 1 A
> 2 BB
> 3 CCC
>
> Arne
>
Well, look at what you've done. Now I seem to know more than I wanted
to know.
Ok, sorry, a bit, for being a wise ass. It just comes so natural.
I don't do much with text, and I seem to do quite well with Instr and
Parse with XML, which I really do not like, when I need to.
As I may have mentioned before, I like things to be rather easy to
understand, and I'll take that over complex and powerful many times.
But I believe you were trying to be helpful, and for that, thank you.
--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486
More information about the Info-vax
mailing list