Hand-Rolled Functions

It is certainly not necessary to dwell at length on hand-rolled functions—I am sure that you are a few steps ahead of me here! However, a few quick examples may be in order.

Listing 22.6 contains a function written in VB that takes as an argument an XML document and an element name and then returns all instances of that name's element as an XQL document.

Listing 22.6. VB Program to Perform a Search
 Function getTagContent(doc As String, tag As String) As String 'this function returns anXQL query as an xml string containing 'the elements asked for of the name tag in the xml document doc 'declare variables Dim xdoc$, otagstr$, ctagstr$, lstr$, returnstr$ Dim otagpos!, ctagpos! 'initialize variables xdoc = doc 'construct ...

Get XML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.