indent Property
Sets whether to indent output. When set to True, this property indents output for "pretty printing" to reflect the nesting structure of the document.
Usage Syntax
oMXXMLWriter.indent = boolValue boolValue = oMXXMLWriter.indent
Remarks
Boolean. Read/write. The default is False. The general rules of indenting elements are: XML headers and root elements start on a new line with a zero indent; element content, including leading and trailing white spaces, is not changed in any way.
Example
The following example parses books.xml and indents the output.
Dim rdr As New Msxml2.SAXXMLReader50 Dim cnth As IVBSAXContentHandler Dim wrt As New MXXMLWriter50 wrt.indent = True wrt.standalone = True Set cnth = wrt Set rdr.contentHandler = cnth rdr.parseURL ("books.xml") MsgBox wrt.output
Results
The following shows the beginning of the books.xml output with the elements indented for "pretty printing".
<?xml version="1.0" encoding="UTF-16" standalone="yes"?> <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book>
Syntax
[propput] HRESULT indent ( [in] VARIANT_BOOL fIndentMode);
[propget] HRESULT indent ( [out, retval] VARIANT_BOOL * fIndentMode);
Parameters
- fIndentMode
- A Boolean expression (True/False) specifying whether the feature is on or off.
Return Values
- S_OK
- The value returned if no errors are reported.
Remarks
The default of this property is False. Because there is no way to detect white space inside an internal document type definition (DTD), they are always indented.
Value | Description |
---|---|
True | Provide white space for formatting. |
False | No additional indenting requirement. |
To view reference material for Visual Basic or C++ only, click the Language Filter button in the upper-left corner of the page.
See Also
Applies to: MXXMLWriter CoClass