Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 7th, 2006, 10:18 PM
Registered User
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Preserved leading and tailing whitespaces problem

Hi all, i have a problem to preserve the whitespaces when append a string to the DOM object. belows is my coding:

Code:
Dim objDOM As New DOMDocument40
Dim nodeOne As IXMLDOMElement
 
objDOM.preserveWhiteSpace = True
 
Set nodeOne = objDOM.createElement("TestNode")
 
nodeOne.nodeTypedValue = Chr(13) & Chr(13) & Chr(10) & Chr(10) & Chr(32) & Chr(9) & "  hello   " & _
                            Chr(10) & Chr(10) & Chr(13) & Chr(13) & Chr(10) & Chr(32) & Chr(9) & _
                            "?" & Chr(13) & Chr(10) & Chr(32)


When i retrieve back the nodeOne value(1 character by 1 character), the charcter Chr(13) is missing. To solve that problem, i assign the node data type to "string" as shown as below:

Code:
nodeOne.dataType = "string"
Now, all the characters(including character Chr(13) and Chr(10)) between "Hello" and "?" are preserved, but all the leading and tailing white spaces characters, Chr(13), Chr(10), Chr(9), Chr(32). It seems like 'Trim' function in VB.

Can someone please help me to solve the problem?







Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I keep leading and trailing whitespaces? 2BOrNot2B XSLT 2 October 31st, 2008 11:35 AM
White-space preserved David P. Manning XML 1 April 24th, 2007 07:50 AM
checking for any whitespaces furia_cross Javascript How-To 1 September 7th, 2005 05:58 PM
entity references not preserved in XML Output srivalli9 J2EE 0 November 14th, 2003 05:29 PM
Where are my whitespaces going? dimondwoof XSLT 3 July 17th, 2003 08:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.