Microsoft XML SDK 2.6 - XML Reference

IXMLDOMDocument::preserveWhiteSpace Method

IXMLDOMDocument::get_preserveWhiteSpace Method

Indicates whether to preserve all white space in the XML document.

Visual Basic Syntax

boolValue = oXMLDOMDocument.preserveWhiteSpace

C/C++ Syntax

HRESULT get_preserveWhiteSpace(
    VARIANT_BOOL *isPreserving);

Parameters

isPreserving [out]
Value that indicates whether default processing preserves white space.

C/C++ Return Values

S_OK
Value returned if successful.
E_INVALIDARG
Value returned if isPreserving is Null.


IXMLDOMDocument::put_preserveWhiteSpace Method

Sets the value of the preserveWhiteSpace property.

Visual Basic Syntax

objXMLDOMDocument.preserveWhiteSpace = boolValue

C/C++ Syntax

HRESULT put_preserveWhiteSpace(
    VARIANT_BOOL isPreserving);

Parameters

isPreserving [in]
Value that indicates whether default processing preserves white space.

C/C++ Return Values

Returns S_OK if successful, or an error code otherwise.

Remarks

This property is initialized to False.

The preserveWhiteSpace property specifies the default white space handling when the xml:space attribute is set to "default." When preserveWhiteSpace is True, all white space is preserved, regardless of the xml:space settings in the document. When preserveWhiteSpace is False, the values of the xml:space attribute specified in the document determine whether white space is preserved or not.

The xml property does not preserve white space exactly as it appears in the original document. Instead, the object model replaces white space present in the original document with a single newline character in the representation returned by the xml property. Similarly, the text property contains a representation without the leading and trailing spaces and replaces multiple intervening white space characters between words with a single space character.

The text and xml properties preserve white space when the user has set the preserveWhiteSpace property to True and when xml:space on the XML element has the value "preserve".

See Also

IXMLDOMDocument Interface | Handling White Space