This site has been taken over by the staff of www.ASPDeveloper.Net

Please report errors to suggest@aspdeveloper.net

BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
XML DOM
The DOM Property: prefix
The DOM Property: parseError
The DOM Property: parsed
The DOM Property: parentNode
The DOM Property: ownerDocument
The DOM Property: ondataavailable
The DOM Property: nodeValue
The DOM Property: nodeTypeString
The DOM Property: nodeTypedValue
The DOM Property: nodeType
The DOM Property: nodeName
The DOM Property: namespaceURI
The DOM Property: length
The DOM Property: documentElement
The DOM Property: docType
The DOM Property: data
The DOM Property: childNodes
The DOM Property: Attributes
The DOM Property: async
The DOM Property: DOM object properties
<< XHTML
XmlSerializer >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :3218

 

preserveWhiteSpace

Is a member of:

XML DOM Document

Syntax

blnValue = objDOMDocument.preserveWhiteSpace

objDOMDocument.preserveWhiteSpace = blnValue

Remark

This property is a readable and writable property that returns True/False. The default is False. White space is a space, tab, or carriage return (new line) character in your XML file.

This property is useful when you need to preserve the layout (white space) of the data in your XML document. For example, you have as one of your elements a comment that consists of sentences. You would need to preserve the two spaces after a full stop, the carriage return between paragraphs. Well, if you did not specify to preserve the white space for this element, you would lose all this formatting.

In the XML specifications, all white space is meant to be preserved; however, the default behavior of this property in the DOMDocument is False, and as such, the XML and TEXT properties do not preserve the white space.

The text and XML properties will preserve white space when the user has set the preserveWhiteSpace property to True and/or when the xml:space attribute on the XML element has the value preserve. Depending on which you choose from the previous line; the DOMDocument object handles the white space differently.

There are different types of white space:

Preserved: the content of the DOMDocument will be exactly as it's found in the XML file

Trimmed: the leading and trailing spaced in your XML file are removed

Half-preserved: the white space inside your text is preserved, but the white space between tags is normalized

To find more information about how setting your white space affects the output of your text in the DOMDocument, go to the Microsoft website, which explains this quite well.

Example

The following XML example specifies that the white space needs to be preserved:

<ADDRESS>xml:space="preserve">

911 Somewhere Circle,

Canberra,

Australia

</ADDRESS>

Now this data will keep its form when it is displayed.


This manuscript is an abridged version of a chapter from the Manning Publications book XML Programming with VB and ASP. This chapter looks at the Microsoft DOM objects. NOTE: Most images have been removed to increase speed and many of the code comments have also been removed for presentation. Please purchase the book to enjoy the full experience of all the chapters with images and code comments!


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Software Specialist, Linux - Finlan
Linux Core Technical Project Manage
Graphics designer at Tanzania. Expe
Integration Specialist Needed - Wor
Virtualization Server Infrastructur

View all Jobs (Add yours)
View all CV (Add yours)






    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP