Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
 EntityReference Reading and Expansi...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Developer's Guide
EntityReference Reading and Expansion

The capability of expanding general entity references when reading XML data and having the resulting expanded text returned depends on the type of XmlReader used to read the data. Character entity references are always expanded automatically.

The XmlValidatingReader and XmlTextReader classes have an EntityHandling property that specifies how entities should be handled. The EntityHandling property can be set to one of the EntityHandling enumeration values. The default on the XmlValidatingReader class is to expand entity references (the EntityHandling property is set to ExpandEntities by default). The XmlTextReader class does not expand general entities by default (the EntityHandling property is set to ExpandCharEntities by default). When the EntityHandling property is set to ExpandCharEntities, only character entity references are expanded and general entity references are returned as general nodes. In this case, entity references are expanded when the ResolveEntity method is called.

The XmlNodeReader class has a ResolveEntity method that must be called to expand the references. To determine the ability of certain XmlReader objects to resolve entities, see the CanResolveEntity property.

NoteNote:

In the .NET Framework version 2.0, the recommended practice is to create XmlReader instances using the XmlReaderSettings class and the Create method. This allows you to take full advantage of all the new features introduced in the .NET Framework 2.0. For more information, see Creating XML Readers.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker