XML (.NET 1.1) Performance Guidelines
From Guidance Share
Jump to navigationJump to search
- J.D. Meier, Srinath Vasireddy, Ashish Babbar, and Alex Mackman
Design Considerations
- Choose the appropriate XML class for the job.
- Consider validating large documents.
- Process large documents in chunks if possible.
- Use streaming interfaces.
- Consider hard-coded transformations.
- Consider element and attribute name lengths.
- Consider sharing the XmlNameTable.
Parsing XML
- Use XmlTextReader to parse large XML documents.
- Use XmlValidatingReader for validation.
- Consider combining XmlReader and XmlDocument.
- On the XmlReader use the MoveToContent and Skip methods to skip unwanted items.
Validating XML
- Use XmlValidatingReader.
- Do not validate the same document more than once.
- Consider caching the schema.
Writing XML
XSLT Processing
- Use XPathDocument for faster XSLT transformations.
- Consider caching compiled style sheets.
- Split complex transformations into several stages.
- Minimize the size of the output document.
- Write efficient XSLT.