Cannot Get Whitespace Characters

Questions about XML that are not covered by the other forums should go here.
ivan603
Posts: 8
Joined: Wed Nov 09, 2005 12:31 pm

Cannot Get Whitespace Characters

Post by ivan603 » Fri Jan 27, 2006 12:02 pm

I have a problem to get the content's characters using DOM object in VB. Belows are my coding:

Code: Select all

 
Dim objDOM As New DOMDocument40
Dim nodeOne As IXMLDOMElement

objDOM.preserveWhiteSpace = True
Set nodeOne = objDOM.createNode("element", "TestNode", "")

nodeOne.nodeTypedValue = Chr(13) & Chr(10) & Chr(32) & Chr(9) & " hello " & _
Chr(10) & Chr(13) & Chr(32) & Chr(9) & _
"?" & Chr(13) & Chr(10) & Chr(32)
When i retrieve back the content(one chanracter by one character) from nodeOne, the character Chr(13) has missing.

Because of that, i add a line of coding to assign the node data type to "string" as shown as belows:

Code: Select all

nodeOne.dataType = "string"
now, the characters Chr(13) is preserved but the problem now is all the whitespaces infront of "Hello" and all the whitespaces after the character "?" has missing. It seems like 'Trim' function in VB.

Can someone know how to preserve all the whitespaces, please reply my message.

Thank you.