I have nodes that can be empty in my XML Document.

Example:

<mydoc>
<attachment></attachment>
<mydoc>

The attachment node may or may not be empty depending upon if there is an attachment.

How do I update the innertext, as of now the code below throws an null exception:

Code:
    Public Sub SetXMLArgsValue(ByVal ConfigName As String, ByVal NewValue As Integer)
        Dim Node As String
        Dim xmlDoc As New XmlDocument
        Dim xmlNode As XmlNode

        Try
            'load document
            xmlDoc.Load(Application.StartupPath & "\Config.xml")
            'set node base
            Node = "/mydoc/" & ConfigName
            'get node
            xmlNode = xmlDoc.SelectSingleNode(Node)
            'get node value
            xmlNode.InnerText = NewValue'<----exception thrown here
            'save 
            xmlDoc.Save(Application.StartupPath & "\Config.xml")
        Catch ex As Exception
            Throw New Exception(ex.Message & " - SetXMLConfigValue")
        Finally
            xmlNode = Nothing
            xmlDoc = Nothing
        End Try
    End Sub