Cannot Get Whitespace Characters

Questions about XML that are not covered by the other forums should go here.
ivan603
Posts: 8

Cannot Get Whitespace Characters

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.

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 0 guests