Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Articles
Search: 

A small XML class
Michel Fournier, May 1, 2006
In this article, Michel Fournier is providing a small introduction to manipulating XML data from VB.NET. The use of XML is now widely used for various purposes such as exchanging data between application, platforms and other environments. XML is a simple and very flexibile text format that can be ma...
Summary
In this article, Michel Fournier is providing a small introduction to manipulating XML data from VB.NET. The use of XML is now widely used for various purposes such as exchanging data between application, platforms and other environments. XML is a simple and very flexibile text format that can be manipulated from any environment. This article provides an overview of manipulating XML data by the use of a simple class.
Description
In this article, I am providing a small introduction to manipulating XML data from VB.NET. The use of XML is now widely used for various purposes such as exchanging data between application, platforms and other environments. XML is a simple and very flexible text format that can be manipulated from any environment. This article provides an overview of manipulating XML data by the use of a simple class.

Overview

As XML is widely used in most of the applications, there was a need to build this in a class that I can make it evolved from applications to applications. The class is part of Level Extreme .NET Framework but can be used separately as is. Once an instance of the class is created, its methods and properties become available for the required XML data manipulation.

The basic requirements of such a class is to be able to read and set specific node values, verify for the presence of a node, design it in a way that namespace support would be available, add attachments and obtain the ability to achieve other related data manipulation.

The XML file

For the purpose of this article, the following XML file will be used:

<NewDataSet>
  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Temp">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="PrimaryKey" type="xs:string" minOccurs="0" />
                <xs:element name="FirstName" type="xs:string" minOccurs="0" />
                <xs:element name="LastName" type="xs:string" minOccurs="0" />
                <xs:element name="Company" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Temp>
    <PrimaryKey>1</PrimaryKey>
    <FirstName>Michel</FirstName>
    <LastName>Fournier</LastName>
    <Company>Level Extreme Inc.</Company>
  </Temp>
  <Temp>
    <PrimaryKey>2</PrimaryKey>
    <FirstName>James</FirstName>
    <LastName>Bond</LastName>
    <Company>United Artist Inc.</Company>
  </Temp>
  <Temp>
    <PrimaryKey>3</PrimaryKey>
    <FirstName>King</FirstName>
    <LastName>Kong</LastName>
    <Company>From the Island Inc.</Company>
  </Temp>
  <Temp>
    <PrimaryKey>4</PrimaryKey>
    <FirstName>Super</FirstName>
    <LastName>Man</LastName>
    <Company>My Company Inc.</Company>
  </Temp>
</NewDataSet>
This is a simple dataset which has been converted into a XML file. It contains four rows with four fields from our employees table.

Creating an instance of the class

In order to benefit of this class, we need to create an instance of it first. The following syntax can be used for that purpose:

        Dim loXML As Framework.Framework.XML = New Framework.Framework.XML
As our class is part of Framework.dll and within the Framework namespace, this syntax is needed.

Reading the XML in memory

In order to be able to start doing any data manipulation from our XML file, we need to read the XML content into memory. The LoadXML() method is used for that purpose. The following takes the content of the XML file from d:\Data.xml and loads it into our class:

        Dim lcXML As String
        lcXML = LXFramework.FileToStr("d:\Data.xml")
        If Not loXML.LoadXml(lcXML) Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If
        MessageBox.Show(loXML.cXml)
As the LoadXML() is reading the content of a string, we need to transfer the file content into a variable. We can then use the lcXML variable as the parameter value when calling that method.

Note that I am using the framework function FileToStr() to read the file content into a variable. This function is as follow:

        ' FileToStr() VFP equivalent
        ' expC1 File name
        Public Function FileToStr(ByVal tcFileName As String) As String
            Dim loFile As IO.StreamReader
            Dim lcString As String
            Try
                loFile = New IO.StreamReader(tcFileName, System.Text.Encoding.Default)
                lcString = loFile.ReadToEnd()
                loFile.Close()
            Catch loError As Exception
                oApp.ErrorSetup(loError)
                lcString = ""
            End Try
            Return lcString
        End Function

Reading a node value

One of the first needs when manipulating the data from a XML file is the ability to read a node value. For that purpose, our class contains a method GetXMLNodeValue().

As we have more than one row, a proper syntax should be used in order to assure which employee row we want to read and set the node value from. By referencing the node structure with an ID, we can achieve that request:

        If Not loXML.GetXMLNodeValue("//NewDataSet/Temp[1]/PrimaryKey") Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If

        MessageBox.Show(loXML.cNodeInnerText)
If the GetXMLNodeValue() succeeds, than the value of the node will be stored in cNodeInnerText property.

In this call, we wanted to get the primary key of the first row. If we would want to get the first name of the 3rd row, the following can be used:

        If Not loXML.GetXMLNodeValue("//NewDataSet/Temp[3]/FirstName") Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If

        MessageBox.Show(loXML.cNodeInnerText)

Setting a node value

The ability to set a node value goes the same way as reading it. For that purpose, our class contains a methods SetXMLNodeValue().

A similar syntax can be used to set a node value of a specific row. To change the row #2 Company node value to "MI6 Inc.", we would do the following:

        If Not loXML.SetXMLNodeValue("//NewDataSet/Temp[2]/Company", "MI6 Inc.") Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If

        If Not loXML.GetXMLNodeValue("//NewDataSet/Temp[2]/Company") Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If

        MessageBox.Show(loXML.cNodeInnerText)

Saving the XML to a file

Once our changes have been applied to the XML, we can then save it to a file. The following function can be used for that purpose:

        ' Save the new XML file
        LXFramework.CreateFile(loXML.cXml, "d:\DataUpdated.xml")
This function is part of the framework. Thus, it is not included as a method of our class. But, to obtain the XML content, we can use loXML.cXML. This property is always up to date in our class and can be used in such circumstance. The CreateFile() function is as follow:
        ' Create a file
        ' expC1 String
        ' expC2 File
        Public Function CreateFile(ByVal tcString As String, ByVal tcFile As String) As Boolean
            Dim llSuccess As Boolean
            Dim loFile As IO.StreamWriter
            llSuccess = False
            Try
                loFile = New IO.StreamWriter(tcFile)
                loFile.WriteLine(tcString)
                loFile.Close()
                llSuccess = True
            Catch loError As Exception
                oApp.ErrorSetup(loError)
            End Try
            Return llSuccess
        End Function

Working with namespaces

Most of the XML files you will use contain namespaces. When present, we need to consider a referenced syntax to make sure our node is well found and processed.

Lets assume we have the following XML:

<EmployeeRecords xmlns="http://www.levelextreme.com/Management">
  <Temp>
    <PrimaryKey>1</PrimaryKey>
    <FirstName>Michel</FirstName>
    <LastName>Fournier</LastName>
    <Company>Level Extreme Inc.</Company>
  </Temp>
  <Temp>
    <PrimaryKey>2</PrimaryKey>
    <FirstName>James</FirstName>
    <LastName>Bond</LastName>
    <Company>United Artist Inc.</Company>
  </Temp>
</EmployeeRecords>
Doing this will generate the following error:
        If Not loXML.GetXMLNodeValue("//EmployeeRecords/Temp[1]/PrimaryKey") Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If

The proper syntax in this case would be:

        loXML.AddNamespace("http://www.levelextreme.com/Management", "ns")

        If Not loXML.GetXMLNodeValue("//ns:EmployeeRecords/ns:Temp[1]/ns:PrimaryKey") Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If
Note that our class contains a method AddNamespace() which is used to load a namespace in memory. Thus, when the proper syntax is used, the node can then be retrieved.

Adding an attachment

One of the uses of working with XML file is the ability to embed file attachments into it. This is great as it allows to embed one or multiple files into the actual XML. Our class includes a method AddXMLAttachment() which is used for that purpose. This method accepts the node as well as the file name for the parameters. With that, the class can include an attachment to the related node. This assumes the node already exists.

Lets assume we have the following XML:

<EmployeeRecords>
  <Temp>
    <PrimaryKey>1</PrimaryKey>
    <FirstName>Michel</FirstName>
    <LastName>Fournier</LastName>
    <Company>Level Extreme Inc.</Company>
    <ExcelSpreadsheet></ExcelSpreadsheet>
  </Temp>
</EmployeeRecords>
To add an Excel spreadsheet to it, we could then use:
        If Not loXML.AddXMLAttachment("//EmployeeRecords/Temp/ExcelSpreadsheet", _
         "d:\Excel.xls") Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If

        ' Save the new XML file
        LXFramework.CreateFile(loXML.cXml, "d:\DataUpdated.xml")
This would give a XML file like this:

Note that I only show a portion of the XML as the attachment is very long.

Reading an attachment

In order to extract an attachment from a XML file, we can use the GetXMLAttachement() method. This method returns the string of the attachment. You can then save that string to a file and you should be able to work with the file in its original format.

Following our last example, to retrieve the attachment, we would do this:

        If Not loXML.GetXMLAttachment("//EmployeeRecords/Temp/ExcelSpreadsheet") Then
            MessageBox.Show(LXFramework.cError)
            Exit Sub
        End If

        ' Save the attachement
        LXFramework.CreateFile(loXML.cAttachment, "d:\ExcelFromAttachement.xls")
Once the GetXMLAttachement() method is done, the string is saved in the cAttachment property which can be used to create the file.

Conclusion

This class should help you get started if you don't have anything yet as far as manipulating a XML content. The class also includes other methods such as the ability to add an attachment directly from a string, to verify if a node exists and for various other needs.

Of course, this class is only a beginning point for XML processing. I use it as part of the Level Extreme .NET Framework.

Here is the code of the class. It can be adjusted to avoid the use of the framework by simply removing the New() method and adjusting where needed.

Imports System.IO
Imports System.XML

Namespace Framework

    Public Class XML
        Public cAttachment As String = ""
        Public cNodeInnerText As String = ""
        Public oApp As Framework.App
        Public cXml As String = ""
        Public oXmlDocument As XmlDocument = New XmlDocument
        Public oXmlElement As XmlElement
        Public oXmlNameSpaceManager As XmlNamespaceManager
        Public oXmlNode As XmlNode
        Public oXmlNodeList As XmlNodeList
        Public cXmlNameSpaceManager As String = ""
        Public cXmlNameSpaceManagerPrefix As String = ""

        Public Sub New(ByVal toApplication As Framework.App)
            oApp = toApplication
        End Sub

        ' Add a tag in the XML
        ' expC1 Tag
        ' expC2 Value
        Public Function AddTag(ByVal tcTag As String, ByVal tcValue As String) As String
            Dim lcXML As String
            Dim lcValue As String
            lcXML = ""
            lcValue = tcValue
            lcValue = Trim(lcValue)
            lcValue = oApp.StrTran(lcValue, "&", "&")
            lcValue = oApp.StrTran(lcValue, "'", "'")
            lcValue = oApp.StrTran(lcValue, """", """)
            lcValue = oApp.StrTran(lcValue, "<", "<")
            lcValue = oApp.StrTran(lcValue, ">", ">")
            lcXML = "<" + tcTag + ">" + lcValue + "</" + tcTag + ">"
            lcXML = lcXML + oApp.cCR
            Return lcXML
        End Function

        ' Add an element in the XML
        ' expC1 Element
        Public Function AddElement(ByVal tcElement As String) As String
            Dim lcXML As String
            lcXML = "<" + tcElement + ">"
            lcXML = lcXML + oApp.cCR
            Return lcXML
        End Function

        ' Close an element in the XML
        ' expC1 Element
        Public Function CloseElement(ByVal tcElement As String) As String
            Dim lcXML As String
            lcXML = "</" + tcElement + ">"
            lcXML = lcXML + oApp.cCR
            Return lcXML
        End Function

        ' Convert an XML string, which is a VFP CursorToXml(), into a DataSet
        ' expC1 String
        Public Function ImportXML(ByVal tcXML As String) As DataSet
            Dim lcString As New StringReader(tcXML)
            Dim loData As New DataSet
            loData.ReadXml(lcString)
            Return loData
        End Function

        ' Load the Xml
        ' expC1 Xml
        Public Function LoadXml(ByVal tcXml As String) As Boolean
            Try
                oXmlDocument.LoadXml(tcXml)
            Catch loError As Exception
                oApp.ErrorSetup(loError)
                Return False
            End Try
            cXml = oXmlDocument.OuterXml
            Return True
        End Function

        ' Add a namespace
        ' expC1 Uri
        ' expC2 Namespace
        Public Function AddNamespace(ByVal tcUri As String, _
         ByVal tcNamespace As String) As Boolean
            Try
                oXmlNameSpaceManager = New XmlNamespaceManager(oXmlDocument.NameTable)
                oXmlNameSpaceManager.AddNamespace(tcNamespace, tcUri)
            Catch loError As Exception
                oApp.ErrorSetup(loError)
                Return False
            End Try
            Return True
        End Function

        ' Get a XML node value
        ' expC1 Node
        Public Function GetXMLNodeValue(ByVal tcNode As String) As Boolean

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode)
            Else
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode, oXmlNameSpaceManager)
            End If

            ' See if we obtained the node
            If oXmlNode Is Nothing Then
                oApp.cError = "The node " + tcNode + " does not exist."
                Return False
            End If

            Try
                cNodeInnerText = oXmlNode.InnerText
            Catch loError As Exception
                oApp.ErrorSetup(loError)
                Return False
            End Try
            Return True
        End Function

        ' Get a XML node list
        ' expC1 Node
        Public Function GetXMLNodeList(ByVal tcNode As String) As Boolean

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNodeList = oXmlDocument.SelectNodes(tcNode)
            Else
                oXmlNodeList = oXmlDocument.SelectNodes(tcNode, oXmlNameSpaceManager)
            End If

            ' See if we obtained the node
            If oXmlNodeList Is Nothing Then
                oApp.cError = "The node " + tcNode + " does not exist."
                Return False
            End If

            Try
                oXmlNodeList = oXmlDocument.SelectNodes(tcNode)
            Catch loError As Exception
                oApp.ErrorSetup(loError)
                Return False
            End Try
            Return True
        End Function

        ' See if a node exists
        ' expC1 Node
        Public Function IsXMLNode(ByVal tcNode As String) As Boolean

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode)
            Else
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode, oXmlNameSpaceManager)
            End If

            ' See if we obtained the node
            If oXmlNode Is Nothing Then
                Return False
            End If

            Return True
        End Function

        ' Add a XML attachment
        ' expC1 Node
        ' expC2 File
        Public Function AddXMLAttachment(ByVal tcNode As String, _
         ByVal tcFile As String) As Boolean
            Dim lcXml As String

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode)
            Else
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode, oXmlNameSpaceManager)
            End If

            ' See if we obtained the node
            If oXmlNode Is Nothing Then
                oApp.cError = "The node " + tcNode + " does not exist."
                Return False
            End If

            ' Add the file
            lcXml = oApp.FileToStr(tcFile)

            ' If we had an error
            If lcXml.Length = 0 Then
                Return False
            End If

            oXmlNode.InnerText = _
             Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(lcXml))

            cXML = oXmlDocument.OuterXml
            Return True
        End Function

        ' Add a XML attachment from a string
        ' expC1 Node
        ' expC2 String
        Public Function AddXMLAttachmentFromString(ByVal tcNode As String, _
         ByVal tcString As String) As Boolean
            Dim lcXml As String

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode)
            Else
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode, oXmlNameSpaceManager)
            End If

            ' See if we obtained the node
            If oXmlNode Is Nothing Then
                oApp.cError = "The node " + tcNode + " does not exist."
                Return False
            End If

            ' Add the file
            lcXml = tcString

            oXmlNode.InnerText = _
             Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(lcXml))

            cXML = oXmlDocument.OuterXml
            Return True
        End Function

        ' Get a XML attachment
        ' expC1 Node
        Public Function GetXMLAttachment(ByVal tcNode As String) As Boolean

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode)
            Else
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode, oXmlNameSpaceManager)
            End If

            ' See if we obtained the node
            If oXmlNode Is Nothing Then
                oApp.cError = "The node " + tcNode + " does not exist."
                Return False
            End If

            ' Get the file
            cAttachment = _
             System.Text.Encoding.Default.GetString(Convert.FromBase64String(oXmlNode.InnerText))

            Return True
        End Function

        ' Set a XML node value
        ' expC1 Node
        ' expC2 Value
        Public Function SetXMLNodeValue(ByVal tcNode As String, _
         ByVal tcValue As String) As Boolean

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode)
            Else
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode, oXmlNameSpaceManager)
            End If

            ' See if we obtained the node
            If oXmlNode Is Nothing Then
                oApp.cError = "The node " + tcNode + " does not exist."
                Return False
            End If

            Try
                oXmlNode.InnerText = tcValue
            Catch loError As Exception
                oApp.ErrorSetup(loError)
                Return False
            End Try
            cXML = oXmlDocument.OuterXml
            Return True
        End Function

        ' Add an element
        ' expC1 Node
        ' expC2 Element
        Public Function AddXMLElement(ByVal tcNode As String, _
         ByVal tcElement As String) As Boolean

            ' Create the node
            Try
                oXmlElement = oXmlDocument.CreateElement(tcElement)
            Catch loError As Exception
                oApp.ErrorSetup(loError)
                Return False
            End Try

            ' Select the node
            If oXmlNameSpaceManager Is Nothing Then
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode)
            Else
                oXmlNode = oXmlDocument.SelectSingleNode(tcNode, oXmlNameSpaceManager)
            End If

            ' See if we obtained the node
            If oXmlNode Is Nothing Then
                oApp.cError = "The node " + tcNode + " does not exist."
                Return False
            End If

            ' Add the node
            oXmlNode.AppendChild(oXmlElement)

            cXML = oXmlDocument.OuterXml
            Return True
        End Function

    End Class

End Namespace
Michel Fournier, Level Extreme Inc.
Michel Fournier is a professional, visionary, perfectionist, mostly known for his renowned realizations over the years, designer, architect, owner of the « Level Extreme Platform », formerly known as the « Universal Thread », recognized as one of the longest running Web sites of the planet, also known as a precursor to social networking, product manager, Internet serial entrepreneur, practiced Lean Startup techniques long before they were known, out of the box thinker, using the tenth man rule, specializes in building entire virtual data center solutions, has provided high end IT consulting worldwide, has owned and operated three companies, delivered worldwide renowned e-commerce Web sites, designed and architected two world class top level development frameworks, wrote over 100 IT articles for various sources, presented at user groups, conventions and corporations nationwide as well as in the US, has provided his contribution in political and legal issues to provide a better world, Owner and Senior IT Consultant at Level Extreme Inc., former Architect Software/Application & Project Manager, 7 times Microsoft Most Valued Professional for VB.NET, 7 times Microsoft Most Valued Professional for Visual FoxPro, Developers Choice award for best site at VFP DevCon 2000 Connections in New Orleans, featured in Acadie Nouvelle on October 2003.
More articles from this author
Michel Fournier, February 1, 2007
From the Level Extreme .NET Framework, this small class allows a developer to manipulate easily the content of a directory by the use of a dataset. With the setup of a few properties, a call to the method and the access to the object dataset, you can have access to the file properties of the directo...
Michel Fournier, August 1, 2001
It is interesting to see how something new can evolve. This is the case for the Universal Thread Magazine. We are now at our 3rd issue and we are already overbooked by scheduled articles and hot stuff we have to cover for the upcoming issues. Publishers are sending request for book reviews, wri...
Michel Fournier, October 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Co-editor Martín Salías Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez José Cavalcanti Moacyr Zalcman Fábio Vieira M...
Michel Fournier, October 1, 2001
In our daily things we do, sometimes we find ourselves in unexpected situations. Such situations, either in our personal life or from our professional work, require some adjustments in order to walk through them. The ability to take some time to take an overall look of what is happening, apply a bas...
Michel Fournier, March 1, 2007
In this small article, Michel discusses a problem he recently encountered when converting a dataset into XML to be used later on with a XSL transformation to export into an Excel sheet. When null values were present in the dataset, this was creating weird result. This article provides a quite alte...
Michel Fournier, February 1, 2006
This article discusses a simple banner fonctionalities function which can ease the display of banners on Web sites. If your Web site displays banners in GIF, JPG of Flash format, this function could be useful to you.
Michel Fournier, January 1, 2006
There are various ways to authenticate a user to a Web Service. This article discusses one way to do it by the use of Cookies. As it could the case with a Web page sending a cookie to the browser, the same can be used from within a Web Service.
Michel Fournier, February 1, 2006
This article is a follow up on the first part of this article which appeared on our January 2006 issue. In this one, Michel discussed further implementation of getting the authentication from a members table as well as setting up a session per user.
Michel Fournier, December 1, 2003
Visual FoxPro and .NET are two great environments to build business applications with. But, fantastic they are when you combine them together in order to increase the strenght of the flexibility to respond to your client needs. In this article, I will demonstrate a case study in regards to a new ser...
Michel Fournier, December 1, 2002
Over the years, I have been involved in several types of desktop and Web applications. Every time you start a new project, there is always something new you will learn. In this article, I would like to detail some of the issues which are to be considered when delivering a Web based application. Thos...
Michel Fournier, January 1, 2003
This article is a follow-up with more advanced details in regards to the first article of this series in our December issue which included a tip on dealing with stylesheets. This one allows you to customize your HTML code based on the user, assuming each user has some ways to setup some specific sty...
Michel Fournier, March 1, 2003
The first two articles of this series have been published in the issues of December 2002 and January 2003. In this one, I will talk about graphic issues, how to negotiate with a form to launch his transaction to either within the same window or a new one, how to gather values from one page to anothe...
Michel Fournier, April 1, 2003
In this article, I will proceed with considerations about HTTP server variables being received from a browser and about considerations for opening new windows in your Web application. Relying on the protocol or not When it first started, we didn't ask that question to ourselves as to know ...
Michel Fournier, April 1, 2009
This articles describes the use of CDO.Message to gain the ability to retrieve a URL as a MHT file. It also covers an interesting approach to retrieve a URL even if this one requires a login.
Michel Fournier, January 1, 2006
Data dictionaries has its use and also for Web applications. I see many developers building Web applications who forget about many structured that used to be in place when developping desktop applications. The same should apply for Web applications as it is no different. This article discusses some ...
Michel Fournier, June 1, 2003
DevTeach was held in Montreal from May 10-13, 2003. It presented a new breed of conference. Sessions included both presentation material and, whenever possible, hands-on training. DevTeach brought under the same roof the best speakers available for .NET, SQL Server and Visual FoxPro as well as Micro...
Michel Fournier, May 1, 2002
The Essential Fox conference was held this weekend in Independence, MO. Once again, the Universal Thread team was on site to do the official coverage of the event. It has been a great success, well planned by Russ Swall, the event owner, and his team and well appreciated by the attendees. A total of...
Michel Fournier, April 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez Claudio Rola José Cavalcanti Moacyr Zalcman Ricardo Soares Fábio Vieira ...
Michel Fournier, September 1, 2001
Ever wonder how to successfully and rapidly display HTML lists to your users? Well, we all probably already did. However, its implementation differs a lot from sites to sites as we all have our own different approaches. Delivering Visual FoxPro data to the Web as if you would be in Visual FoxPro is ...
Michel Fournier, November 1, 2001
A lot of things happened recently in the Visual FoxPro world and for related technologies. The Great Lakes Great Database Workshop was being held in Milwaukee from Sunday October 27 to Wednesday October 31. That conference which primaly focused on Visual FoxPro has covered a lot of technologies...
Michel Fournier, November 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Co-editor Martín Salías Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez José Cavalcanti Moacyr Zalcman Fábio Vieira M...
Michel Fournier, January 1, 2003
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Co-editor Martín Salías Translation coordinators Claudio Lassala Martín Salías Translators Rodolfo Duarte Fábio Vazquez Moacyr Zalcman Martín Salías Antonio Castaño Fabián Belo Rafae...
Michel Fournier, December 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Co-editor Martín Salías Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez José Cavalcanti Moacyr Zalcman Fábio Vieira M...
Michel Fournier, November 1, 2001
I have been following several threads on the Universal Thread recently about FTP from Visual FoxPro. I have used an ActiveX for a while to do such a task. I have found that years after years, the problem is that you have to maintain that ActiveX for your own workstation and for every servers or work...
Michel Fournier, July 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Co-editor Martín Salías Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez José Cavalcanti Moacyr Zalcman Fábio Vieira M...
Michel Fournier, January 1, 2006
With the beginning of the new year, Michel resumes some of the highlights of the Universal Thread and what is coming up for the new season.
Michel Fournier, March 1, 2006
When comes time to display the content of a memo field on a Web page, one common task we have to do is to hyperlink specific content. This article discusses about a technique which can be used to hyperlink various types of links as well as email addresses.
Michel Fournier, April 1, 2009
This article describes some basic techniques to manipulate some images in .NET. It covers image resizing, image cropping and the ability to save an image into a JPG high resolution format.
Michel Fournier, May 1, 2007
This short articles provides an approach of important data from an Excel sheet into your application without having the requirement of having Excel installed on the server.
Michel Fournier, August 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Co-editor Martín Salías Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez José Cavalcanti Moacyr Zalcman Fábio Vieira M...
Michel Fournier, July 1, 2001
Recently, I was having problems while working on several projects on my PC. The problems were happening when I had several applications open at the same time. When the problem occured, I had to reboot my PC and then was able to work for a few hours up to a few days until the next reboot. As I was wo...
Michel Fournier, June 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Co-editor Martín Salías Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez José Cavalcanti Moacyr Zalcman Fábio Vieira M...
Michel Fournier, September 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Co-editor Martín Salías Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez José Cavalcanti Moacyr Zalcman Fábio Vieira M...
Michel Fournier, January 1, 2001
Xitech (Europe) produces tools for the Windows software developer. They specialize in FoxPro Developer tools, data and code recovery and security. In this article, we will see an overview of 5 of their tools. You will find more details about each of them from Xitech documentation. To get Xitech cont...
Michel Fournier, April 1, 2006
This article discusses the ability to use Visual FoxPro to schedule a list of tasks to be executed at specific intervals. While there could be the approach of using the Windows Scheduler to execute those tasks, it is always interesting to be able to control everything from within VFP. A small VFP sc...
Michel Fournier, April 1, 2006
This article describes an overview of sending an email from VB.NET. It covers the basis of creating the email functionality in a class and using an instance of that class to define and send the email. The class includes the ability to send to multiple recipients as well as sending attachments. Sendi...
Michel Fournier, July 1, 2002
This is a follow up on my previous article on using SOAP protocol for authentication that appeared in our December 2001 issue. That article was mentioning the use of the SOAP header for authentication such as being able to identify the user for any upcoming hit to your Web Service as soon as the Log...
Michel Fournier, May 1, 2002
UTMag/RapoZine team Editors Michel Fournier Claudio Lassala Translation coordinators Claudio Lassala Martín Salías Translators Eduardo Vidigal Rodolfo Duarte Fábio Vazquez José Cavalcanti Moacyr Zalcman Fábio Vieira Martín Salías Antonio Castañ...
Michel Fournier, July 1, 2002
From recent discussions I had, with several persons from my team, about common patterns which occur in the evolution of the Universal Thread, I thought it would be nice to write an article about it. Basically, within the evolution of a product, there are some similitudes which are sometimes interest...
Michel Fournier, June 1, 2001
Welcome to our first issue of the Universal Thread Magazine. We kept receiving many requests to have such a media available on the Universal Thread, so we decided to release our first issue this month. Many people have mentioned an interest to either have such a magazine for the pleasure to read abo...
Michel Fournier, December 1, 2001
The Visual FoxPro Zone evolves As many of you may have seen, the Universal Thread Visual FoxPro Zone is evolving quite fast. In the last month, we added new content in it. As usual, the most popular option is the Toledo Wish List. Several entries are created every day. This is the place to co...
Michel Fournier, January 1, 2002
It's January 3rd, 2002, I am writing this editorial at 20h32 EST. The Christmas break is over but was it really a break? More and more, years after years, I keep seeing a lot of persons online during Christmas day or a few minutes before the new year. And, I mean, they are online as per their own ti...
Michel Fournier, January 1, 2004
In December 1993, a great history started when a small Web site known as the Visual FoxPro Yellow Pages started. Basically, a site providing ads for Visual FoxPro developers such as jobs and consulting services. Known also as the first Visual FoxPro site, it has evolved quite fast during the first t...
Michel Fournier, January 1, 2006
In the recent months, I have been involved in settings various projects at client sites, as well as for Level Extreme Web sites, which involved the support of uploading image files from an Internet browser. The process of supporting that capability in your application, either from a desktop of from ...
Michel Fournier, December 1, 2001
The Microsoft SOAP client provides access to any Web Service. Once the object is instantiated and the location of the WSDL file given, you are ready to go to access any method. Thus, based on what is supported by the Web Service, you can query to obtain various types of content such as string and bo...
Michel Fournier, February 1, 2002
On January 15th, 2002, an important joint took place for our magazine. The Universal Thread Magazine and RapoZine magazine, an online magazine available for the Portuguese developers community, joined to create UTMag/RapoZine. Effective from this issue, both magazines will offer the same technical c...
Michel Fournier, July 1, 2002
Show seconds in a readable format If you need to check elapsed time with seconds() or a datetime value, this function allows you to display the elapsed time in a human-readable format, that is, hours:minutes:seconds, instead of the total number of seconds. Just pass a number of seconds as...
Michel Fournier, August 1, 2002
Updating your DLL on IIS This has been a common question in the recent months on the Universal Thread. More and more, developers have the need to use a DLL under IIS. However, the fun part comes when you need to update it. As soon as it kicks in, you can't update your DLL anymore as it re...
Michel Fournier, September 1, 2002
Getting image width and height Probably the most flexible way to extract the width and height of an image is by the use of the image object. All is needed is to load the image in the object and get the values from the Width and Height properties. LOCAL loImage,lnWidth,lnHeight loIma...
Michel Fournier, October 1, 2002
Extracting BMPs from general fields As a complement with last issue's article on image handling, yo can find useful this little function. If you got convinced that using general fields to handle images is a bad idea, you can decided go back to independent image files. But then you'll...
Michel Fournier, November 1, 2002
Use MemLines() to wrap text lines When you need to wrap some text at a given width (say 75 characters per line), you do it easily with: SET MEMOWIDTH TO 75 lcMemo = lcNewMemo = "" _MLINE = 0 FOR i= 1 TO memlines(lcMemo) lcNewMemo = lcNewMemo ; + MLINE(lcMemo,1,_MLINE...
Michel Fournier, June 1, 2001
It was a year ago. The DevConnections team was holding the Visual FoxPro DevCon 2000, the SQL Server Connections and the DevCon 2000 in New Orleans, Louisiana from May 14 to 18, 2000. For the first time, attendees were able to attend sessions from more than one conference at the same time. This offe...
Michel Fournier, September 1, 2001
Is there a speed limit on the Internet? Probably not, because there is so much things we can do in a short time about delivering various type of content to the community. I remember a week ago we shared an idea about helping the promotion of user group activities around the world. A week ago it was ...
Michel Fournier, March 1, 2002
In the last month, we received dozens of emails from satisfied persons in regards for our initiative of opening the magazine and the Universal Thread in general for additional communities such as the Portuguese and Spanish communities. Regulars members of the Universal Thread, new members, Microsoft...