The XmlLite library allows developers to build high-performance XML-based applications that provide a high degree of interoperability with other applications that adhere to the XML 1.0 standard. The primary goals of XmlLite are ease of use, performance, and standards compliance.
XmlLite works with any Windows language that can use dynamic link libraries (DLLs), but Microsoft recommends C++. XmlLite comes with all necessary support files for use with C++, but if you want to use it with other languages, some additional work may be required.
XmlLite works with various versions of the Microsoft C++ compiler, but the samples in the documentation have been validated only with the latest version of Visual Studio.
This topic provides an overview of XmlLite and some guidelines for which XML parser to use in various scenarios.
For installation information, see Installing XmlLite.
Microsoft delivers several XML parsers:
MSXML (SAX2) (native)
The following Document Object Model (DOM) implementations have built-in parsers:
XML can be used as a format for storing documents, such as Microsoft Office Word documents. It can also be used to encode data for marshalling method calls across machine boundaries (SOAP). Businesses can use XML for sending and receiving purchase orders and invoices. Web technologies can use XML to send data between the Web server and the client's Web browser. Database servers can return the data from queries in XML for further processing by other applications. Because it is such a flexible format, XML can be used in a vast variety of scenarios.
Usage scenarios can be generally divided into two categories:
Some scenarios work with XML documents that come from external sources, and it is not known whether the XML documents are valid. In these scenarios, verification of validity is important. Typically, developers use XSD schemas or Document Type Definitions (DTDs) to verify validity. Performance may be a concern, but the overriding concern is that the application reading the XML receives a valid document. Saving and loading documents from and to a variety of applications is a usage scenario that falls in this category.
Some software systems use XML as a data store or a means for communication. In these scenarios, the developer knows that the XML document is valid, perhaps because another part of the system (which is under the control of the same developer or organization) generated the XML. The question of document validity is not an overriding concern. One example of this approach is where the software system runs on a server farm, and XML is used to communicate between various servers and processes. Another example might be one where a relatively complicated application has to store and retrieve a large amount of information. The developer completely controls the format of the XML document.
The focus of XmlLite is on performance. Therefore, XmlLite is most appropriate in the second of the two scenarios. XmlLite enables developers to write efficient (fast) code to read and write XML documents. In most scenarios, XmlLite parses faster than either the DOM in MSXML or SAX2 in MSXML.
XmlLite is most appropriate for use with C++. If you are using C#, Visual Basic .NET, or other languages that use the common language runtime (CLR), it is more appropriate to use one of the parsers in System.XML.
Some developers want a deployment scenario where it is not required that the Microsoft .NET Framework be installed on deployment computers. XmlLite does not require the .NET framework to be installed, and may be appropriate for this situation.
Because XmlLite is oriented towards optimum performance, it does not provide for document validation. Validation via XSD schemas or DTDs is not supported. If you require validation, it is recommended that you use either MSXML or System.XML.
If you read a document that refers to an external XSD schema, the XmlLite reader ignores the external schema. Even if the document is invalid per the schema, the XmlLite reader will report no errors.
If you read a document that contains an inline schema, the XmlLite reader returns all of the elements and attributes of the inline schema, just as if they were parts of the XML document.
XmlLite does not support scripting languages. If you need to use XML from JScript or Visual Basic Scripting Edition (VBScript), it is more appropriate to use the Document Object Model (DOM) in MSXML.
Document Type Definitions (DTDs) are supported, but only for entity expansion and defaults for attributes, not for document validation. If you require DTD validation, it is recommended that you use either MSXML or System.XML.
If you enable DTDs, note the following: If you use XmlLite to read a document that refers to a DTD and the document is not valid per that DTD, no error will be thrown.
Both the XmlLite runtime and development files are required to run the examples in this documentation. For more information, see Installing XmlLite.