303factory
Registered User.
- Local time
- Today, 00:19
- Joined
- Oct 10, 2008
- Messages
- 136
Good afternoon
I'm writing code to read in some XML files and the nodes which are empty seem to be returning strange results with a non-ascii character
For the strNumber value it gives the below value when it should be null/empty
strNumber : " " : String [there is the non-ascii square at the front of this string then several 'spaces']
XML file:
Can anyone shed any light on this? Am I going about reading in the data incorrectly?
Thanks in advance
303
I'm writing code to read in some XML files and the nodes which are empty seem to be returning strange results with a non-ascii character
Code:
Dim MessageList As IXMLDOMNodeList
Dim MessageNode As IXMLDOMNode
Dim childNode As IXMLDOMNode
Set MessageList = objXMLFile.SelectNodes("/reports/report/sms_messages/sms_message")
For Each MessageNode In MessageList
If MessageNode.HasChildNodes Then
For Each childNode In MessageNode.ChildNodes
If childNode.nodeName = "id" Then
intRegNumber = childNode.Text
End If
If childNode.nodeName = "number" Then
strNumber = childNode.Text
End If
If childNode.nodeName = "name" Then
strName = childNode.Text
End If
If childNode.nodeName = "timestamp" Then
strTimeSTamp = childNode.Text
End If
If childNode.nodeName = "status" Then
strStatus = childNode.Text
End If
If childNode.nodeName = "text" Then
strText = childNode.Text
End If
Next
End If
For the strNumber value it gives the below value when it should be null/empty
strNumber : " " : String [there is the non-ascii square at the front of this string then several 'spaces']
XML file:
Code:
<sms_messages>
<sms_message>
<id>
1
</id>
<number>
</number>
<name>
N/A
</name>
<timestamp>
N/A
</timestamp>
<status>
Sent
</status>
<folder>
Sent
</folder>
<type>
Outgoing
</type>
<text>
On sim
</text>
</sms_message>
<sms_messages>
Can anyone shed any light on this? Am I going about reading in the data incorrectly?
Thanks in advance
303