If you have a PH account, you can customize your PH profile.
*/

Other Views

corner
*/

XML FAQ - Improving XML Performance

How can I improve the performance of XML in my applications?

Although a full article can be written on improving XML performance, here are a few considerations for improving performance of your XML related code:
  • Use the right XML object for your task:
  1. Use XmlTextReader to process XML data quickly in a forward, read-only manner.
  2. Use XmlValidatingReader to process and to validate XML data.
  3. Use XPathNavigator to obtain read-only, random access to XML data and to use XPath queries.
  4. Use XmlTextWriter to write XML documents.
  5. Use XPathDocument to process XPath statements and faster XSLT transformations.
  • Validate large documents as much as possible: If there is a chance that a large document may be invalid, consider validating the document first because a lot of CPU resources and memory are wasted when you parse a document which may contain errors.
  • Consider element and attribute name lengths: The length of an element or attribute name affects the document size. Try to use names that are short and meaningful.
  • On the XmlReader, use the MoveToContent and Skip methods to skip unwanted items: XmlReader.MoveToContent method helps to skip white space, comments, and processing instructions, and to move to the next content element. Also the XmlReader.Skip method helps you skip the current element.
  • Do not validate the same document more than once
  • Consider caching the schema: If you repeatedly validate input XML against the same schema for each request, then loading the schema once and retaining it in memory for later requests can improve performance.
  • Avoid the // operator by reducing the search scope.
Back to XML FAQ


corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.
Resource Listings