Expand Minimize
9 out of 12 rated this helpful - Rate this topic

System.Xml Namespace

The System.Xml namespace provides standards-based support for processing XML.

The supported standards include:

  • XML 1.0 - http://www.w3.org/TR/1998/REC-xml-19980210 - including DTD support.

  • XML Namespaces - http://www.w3.org/TR/REC-xml-names/ - both stream level and DOM.

  • XSD Schemas - http://www.w3.org/2001/XMLSchema

  • XPath expressions - http://www.w3.org/TR/xpath

  • XSLT transformations - http://www.w3.org/TR/xslt

  • DOM Level 1 Core - http://www.w3.org/TR/REC-DOM-Level-1/

  • DOM Level 2 Core - http://www.w3.org/TR/DOM-Level-2/

The .NET Framework 4.5, provides a set of asynchronous APIs for XmlReader and XmlWriter, which are based on the Visual Studio Asynchronous Programming model. These APIs provide the ability to process XML asynchronously. It is preferable to use these APIs to perform XML operations with Network IO where latency is noticeable. With these asynchronous APIs, you can write the asynchronous code similar to the synchronous one. Also, you can transit your existing synchronous code to asynchronously code easily.

The following is a list of best practices for using the asynchronous APIs:

  1. Use the asynchronous APIs in applications where there is significant network stream latency. Avoid using the asynchronous APIs for memory stream or local file stream reads and writes. Also, the input Stream, XmlTextReader and XmlTextWriter should support asynchronous operations as well, otherwise threads will still be blocked by IO operations.

  2. Using a mix synchronous and asynchronous function calls is not encouraged since you may forget the use the await keyword on API, or use a synchronous API where an asynchronous one is need.

  3. Do not set the Async or Async flag to true if you do not intend to use an asynchronous API.

  4. If you forget to specify the await keyword when calling an asynchronous API, you may receive either an expected result or an exception, which is non-deterministic.

  5. When reading a large text node, XmlReader may only cache a partial text value and return the text node, so retrieving Value may be blocked by an IO operation. Use the GetValueAsync method to get the text value in asynchronous mode. You may also use ReadValueChunkAsync to read a large text block chunk-by-chunk.

  6. When using XmlWriter, call FlushAsync before calling Close to avoid blocking an IO operation.

  Class Description
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps NameTable Implements a single-threaded XmlNameTable.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps UniqueId A unique identifier optimized for Guids.
Public class XmlAttribute Represents an attribute. Valid and default values for the attribute are defined in a document type definition (DTD) or schema.
Public class XmlAttributeCollection Represents a collection of attributes that can be accessed by name or index.
Public class Supported in .NET for Windows Store apps XmlBinaryReaderSession Enables optimized strings to be managed in a dynamic way.
Public class Supported in .NET for Windows Store apps XmlBinaryWriterSession Enables using a dynamic dictionary to compress common strings that appear in a message and maintain state.
Public class XmlCDataSection Represents a CDATA section.
Public class XmlCharacterData Provides text manipulation methods that are used by several classes.
Public class XmlComment Represents the content of an XML comment.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlConvert Encodes and decodes XML names and provides methods for converting between common language runtime types and XML Schema definition language (XSD) types. When converting data types the values returned are locale independent.
Public class XmlDataDocument Obsolete. Allows structured data to be stored, retrieved, and manipulated through a relational DataSet.
Public class XmlDeclaration Represents the XML declaration node <?xml version='1.0'...?>.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlDictionary Implements a dictionary used to optimize Windows Communication Foundation (WCF)'s XML reader/writer implementations.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlDictionaryReader An abstract class that the Windows Communication Foundation (WCF) derives from XmlReader to do serialization and deserialization.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlDictionaryReaderQuotas Contains configurable quota values for XmlDictionaryReaders.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlDictionaryString Represents an entry stored in a XmlDictionary.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlDictionaryWriter Represents an abstract class that Windows Communication Foundation (WCF) derives from XmlWriter to do serialization and deserialization.
Public class XmlDocument Represents an XML document.
Public class XmlDocumentFragment Represents a lightweight object that is useful for tree insert operations.
Public class XmlDocumentType Represents the document type declaration.
Public class XmlElement Represents an element.
Public class XmlEntity Represents an entity declaration, such as <!ENTITY... >.
Public class XmlEntityReference Represents an entity reference node.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlException Returns detailed information about the last exception.
Public class XmlImplementation Defines the context for a set of XmlDocument objects.
Public class XmlLinkedNode Gets the node immediately preceding or following this node.
Public class XmlNamedNodeMap Represents a collection of nodes that can be accessed by name or index.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlNamespaceManager Resolves, adds, and removes namespaces to a collection and provides scope management for these namespaces.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlNameTable Table of atomized string objects.
Public class XmlNode Represents a single node in the XML document.
Public class XmlNodeChangedEventArgs Provides data for the NodeChanged, NodeChanging, NodeInserted, NodeInserting, NodeRemoved and NodeRemoving events.
Public class XmlNodeList Represents an ordered collection of nodes.
Public class XmlNodeReader Represents a reader that provides fast, non-cached forward only access to XML data in an XmlNode.
Public class XmlNotation Represents a notation declaration, such as <!NOTATION... >.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlParserContext Provides all the context information required by the XmlReader to parse an XML fragment.
Public class XmlProcessingInstruction Represents a processing instruction, which XML defines to keep processor-specific information in the text of the document.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlQualifiedName Represents an XML qualified name.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlReader Represents a reader that provides fast, noncached, forward-only access to XML data.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlReaderSettings Specifies a set of features to support on the XmlReader object created by the Create method.
Public class XmlResolver Resolves external XML resources named by a Uniform Resource Identifier (URI).
Public class XmlSecureResolver Helps to secure another implementation of XmlResolver by wrapping the XmlResolver object and restricting the resources that the underlying XmlResolver has access to.
Public class XmlSignificantWhitespace Represents white space between markup in a mixed content node or white space within an xml:space= 'preserve' scope. This is also referred to as significant white space.
Public class XmlText Represents the text content of an element or attribute.
Public class XmlTextReader Represents a reader that provides fast, non-cached, forward-only access to XML data.
Public class XmlTextWriter Represents a writer that provides a fast, non-cached, forward-only way of generating streams or files containing XML data that conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.
Public class XmlUrlResolver Resolves external XML resources named by a Uniform Resource Identifier (URI).
Public class XmlValidatingReader Obsolete. Represents a reader that provides document type definition (DTD), XML-Data Reduced (XDR) schema, and XML Schema definition language (XSD) validation.
Public class XmlWhitespace Represents white space in element content.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlWriter Represents a writer that provides a fast, non-cached, forward-only means of generating streams or files containing XML data.
Public class Supported by Portable Class Library Supported in .NET for Windows Store apps XmlWriterSettings Specifies a set of features to support on the XmlWriter object created by the XmlWriter.Create method.
Public class XmlXapResolver Obsolete. The XmlXapResolver type is used to resolve resources in the Silverlight application’s XAP package.
  Interface Description
Public interface IApplicationResourceStreamResolver Obsolete. Represents an application resource stream resolver.
Public interface IFragmentCapableXmlDictionaryWriter Contains properties and methods that when implemented by a XmlDictionaryWriter, allows processing of XML fragments.
Public interface IHasXmlNode Enables a class to return an XmlNode from the current context or position.
Public interface IStreamProvider Represents an interface that can be implemented by classes providing streams.
Public interface IXmlBinaryReaderInitializer Provides methods for reinitializing a binary reader to read a new document.
Public interface IXmlBinaryWriterInitializer Specifies implementation requirements for XML binary writers that derive from this interface.
Public interface Supported by Portable Class Library Supported in .NET for Windows Store apps IXmlDictionary An interface that defines the contract that an Xml dictionary must implement to be used by XmlDictionaryReader and XmlDictionaryWriter implementations.
Public interface Supported by Portable Class Library Supported in .NET for Windows Store apps IXmlLineInfo Provides an interface to enable a class to return line and position information.
Public interface IXmlMtomReaderInitializer Specifies implementation requirements for XML MTOM readers that derive from this interface.
Public interface IXmlMtomWriterInitializer When implemented by an MTOM writer, this interface ensures initialization for an MTOM writer.
Public interface Supported by Portable Class Library Supported in .NET for Windows Store apps IXmlNamespaceResolver Provides read-only access to a set of prefix and namespace mappings.
Public interface IXmlTextReaderInitializer Specifies implementation requirements for XML text readers that derive from this interface.
Public interface IXmlTextWriterInitializer Specifies implementation requirements for XML text writers that derive from this interface.
  Delegate Description
Public delegate OnXmlDictionaryReaderClose delegate for a callback method when closing the reader.
Public delegate XmlNodeChangedEventHandler Represents the method that handles NodeChanged, NodeChanging, NodeInserted, NodeInserting, NodeRemoved and NodeRemoving events.
  Enumeration Description
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps ConformanceLevel Specifies the amount of input or output checking that the created XmlReader and XmlWriter objects perform.
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps DtdProcessing Specifies the options for processing DTDs. The DtdProcessing enumeration is used by XmlReaderSettings.
Public enumeration EntityHandling Specifies how the XmlTextReader or XmlValidatingReader handle entities.
Public enumeration Formatting Specifies formatting options for the XmlTextWriter.
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps NamespaceHandling Specifies whether to remove duplicate namespace declarations in the XmlWriter.
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps NewLineHandling Specifies how to handle line breaks.
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps ReadState Specifies the state of the reader.
Public enumeration ValidationType Specifies the type of validation to perform.
Public enumeration WhitespaceHandling Specifies how white space is handled.
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps WriteState Specifies the state of the XmlWriter.
Public enumeration XmlDateTimeSerializationMode Specifies how to treat the time value when converting between string and DateTime.
Public enumeration XmlDictionaryReaderQuotaTypes Enumerates the configurable quota values for XmlDictionaryReaders.
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps XmlNamespaceScope Defines the namespace scope.
Public enumeration XmlNodeChangedAction Specifies the type of node change.
Public enumeration XmlNodeOrder Describes the document order of a node compared to a second node.
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps XmlNodeType Specifies the type of node.
Public enumeration XmlOutputMethod Specifies the method used to serialize the XmlWriter output.
Public enumeration Supported by Portable Class Library Supported in .NET for Windows Store apps XmlSpace Specifies the current xml:space scope.
Public enumeration XmlTokenizedType Represents the XML type for the string. This allows the string to be read as a particular XML type, for example a CDATA section type.
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.