Mono Class Library: System.Xml.XmlTextReader Overview | Members

System.Xml.XmlTextReader Constructor

Constructs and initializes a new instance of the System.Xml.XmlTextReader class with the specified XML fragment. [Edit]

public XmlTextReader (string xmlFragment, XmlNodeType fragType, XmlParserContext context)

Parameters

xmlFragment
A string containing the XML fragment to parse. [Edit]
fragType
The System.Xml.XmlNodeType of the XML fragment. This also determines what the fragment string can contain. (See table below.) [Edit]
context
The System.Xml.XmlParserContext in which the xmlFragment is to be parsed, or null. [Edit]
fragType
Documentation for this section has not yet been entered. [Edit]
context
Documentation for this section has not yet been entered. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionxmlFragment is null. [Edit]
System.Xml.XmlExceptionfragType is not an Element, Attribute, or DocumentSystem.Xml.XmlNodeType. [Edit]

Remarks

The following table lists valid values for fragType and how the reader will parse each of the different node types.

XmlNodeTypeFragment Can Contain
ElementAny valid element content (for example, any combination of elements, comments, processing instructions, CDATA sections, text, and entity references).
AttributeThe value of an attribute (the part inside the quotes).
Document The contents of an entire XML document; document level rules are enforced.
Note:

If the XML fragment is an element or attribute, root level rules for well-formed XML documents are not enforced.

This constructor can handle strings returned from XmlTextReader.ReadInnerXml.

This constructor calls XmlTextReader.XmlTextReader(context.NameTable) or, if context is null, XmlTextReader.XmlTextReader(newSystem.Xml.NameTable()) to initialize properties of the class. Following this call, if context is not null, the following System.Xml.XmlTextReader properties are set to the specified values.

PropertyValue
BaseUricontext.BaseURI or, if context is null, string.Empty.
Encodingcontext.Encoding or, if context or context.Encoding is null, UTF-8.
XmlLangIf context is not null, context.XmlLang. If context is null, this property is not changed.
XmlSpaceIf context is not null, context.XmlSpace. If context is null, this property is not changed.
[Edit]

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0