Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SAX2 Reference

standalone Property

Sets the value of the standalone attribute in the XML declaration to "yes" or "no".

[Visual Basic]

Implementation Syntax

Property Let IMXWriter_standalone(ByVal RHS As Boolean)
Property Get IMXWriter_standalone() As Boolean

Usage Syntax

oMXXMLWriter.standalone = boolValue
boolValue = oMXXMLWriter.standalone

Remarks

Boolean. Read/write.

Example

The following example reads books.xml and writes the value of the standalone attribute to "yes" in the XML declaration.

XML File

Use books.xml.

Visual Basic File (Form1.frm)

Private Sub Command1_Click()(
   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
End Sub

Try It!

  1. Go to books.xml. Copy it to a folder on your computer (such as c:\temp).
  2. Open Visual Basic and create a new Standard EXE project.
  3. Create a reference in the project to Microsoft XML, v5.0.
  4. Add a command button (Command1) to the application form (Form1).
  5. From the View menu, click Code.
  6. Use copy and paste to replace any code in the form with the code provided above.
  7. Save the project and form to the folder on your computer where you saved books.xml in Step 1.
  8. From the Run menu, click Start.
  9. In the test application, click Command1 (the command button).

Output

When run, the sample Visual Basic application should display the contents of books.xml in a message box. The file XML declaration should have its standalone attribute set to "yes", like this:

<?xml version="1.0" encoding="UTF-16" standalone="yes"?>
[C/C++]

Syntax

[propput]
HRESULT standalone (
   [in] VARIANT_BOOL fValue);
[propget]
HRESULT standalone (
   [out, retval] VARIANT_BOOL * fValue);

Parameters

fValue
Boolean.

Return Values

S_OK
The value returned if no errors are reported.

Remarks

Value Description
True Sets the value of the standalone attribute to "yes".
False (default) Sets the value of the standalone attribute to "no".

The XSLProcessor object implements the standalone property as follows:

To view reference information for Visual Basic or C/C++ only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

MXHTMLWriter CoClass | MXXMLWriter CoClass | Sample XML File (books.xml)

Applies to: IMXWriter Interface