Create a Simple Filter

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SAX2 Developer's Guide

Create a Simple Filter

The simple filter example demonstrates how SAX can be used to filter content to create a subset of the original document being parsed. In this example, the application parses books.xml and produces a document fragment that contains only <title> elements and characters. The application is kept simple to demonstrate the fundamental principles involved in transforming documents with SAX, including the following:

  • How to detect the presence of an element in an XML document and how to write the element's content to the application's output.
  • The essential SAX methods you must use to conditionally process content.
  • How to set a flag to indicate across events that an element is within scope.
  • How to create a document fragment.

This topic is divided into the following sections:

See Also

Sample XML File (books.xml)