Partager via


Microsoft SAX2 COM Implementation (Windows CE 5.0)

Send Feedback

As its name states, SAX2 is a simple application programming interface (API) for XML parsers. Microsoft provides a version of this API to use with its parser, the Microsoft® XML Parser (MSXML). This API offers fewer than a dozen interfaces that you can implement to create SAX2 applications for reading and processing XML documents. These interfaces map as closely as possible to the publicly developed, Java language-based SAX2.

Mapping Java Language Interfaces to COM/C++

Implementing the SAX Java language-based interfaces within a COM/C++ environment presents some challenges. In general, the following guidelines are followed.

  • Java language conventions are mapped to COM/C++ conventions as closely as possible.
  • Errors and abnormal conditions are returned in COM through return codes (HRESULTs). Additional fields provided by derived exception classes, such as the line and position of a parsing error, must be accommodated in the class, which returns specific HRESULT values.
  • If a particular class or interface is supposed to be extended, protected members should be made public, because this is the only option in the COM Interface Definition Language (IDL).
  • Friendly default members and methods should be made public if used in other classes or interfaces. Otherwise, they might be hidden in the private section of the implementation behind interfaces.
  • If it is natural and simplifies development using a COM object, a class from a Java language package can be reduced. However, the reduction of the class must be implemented so that additional classes can be introduced without breaking an existing application.

For a list of the Microsoft SAX2 interfaces, see the SAX2 Reference node in the table of contents.

See Also

Getting Started with SAX2

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.