Sure, we've chronicled horrible methods of storing data in XML, but what about when you want to retrieve said data? If you're into .NET, you're probably thinking of something in the System.Xml namespace. If you're a Ruby developer, you're probably thinking of REXML. If you're using PHP, the XML Parser extension. If you're a COBOL programmer, then you're probably praying for death.

Well, if you consider yourself a senior-level XML developer, here's a new technique you can add to your repertoire, courtesy of Paul. Here's an example of a technique dubbed Case-Sensitive Replacement-Based Element Parsing, suitable for all* of your XML documents!

Dim sPath As String = System.AppDomain.CurrentDomain.BaseDirectory.ToString()
sPath = sPath & "Rules\" & sRulesList(iRCount)
Dim File As New StreamReader(sPath)
Dim sLine As String = File.ReadLine.Trim
Dim sExact As String = File.ReadLine.Trim
Dim sNot As String = File.ReadLine.Trim
Dim sCase As String = File.ReadLine.Trim
Dim sCondition As String = File.ReadLine.Trim
Dim sPosition As String = File.ReadLine.Trim
Dim sAction As String = File.ReadLine.Trim
File.Close()
sExact = sExact.Replace("<exact>", "")
sExact = sExact.Replace("</exact>", "")
sNot = sNot.Replace("<not>", "")
sNot = sNot.Replace("</not>", "")
sCase = sCase.Replace("<case>", "")
sCase = sCase.Replace("</case>", "")
sCondition = sCondition.Replace("<condition>", "")
sCondition = sCondition.Replace("</condition>", "")
sPosition = sPosition.Replace("<position>", "")
sPosition = sPosition.Replace("</position>", "")
sAction = sAction.Replace("<action>", "")
sAction = sAction.Replace("</action>", "")

*only for documents that are flat and have each data element on its own line

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!