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 stream containing an XML fragment. [Edit]

public XmlTextReader (System.IO.Stream xmlFragment, XmlNodeType fragType, XmlParserContext context)

Parameters

xmlFragment
The System.IO.Stream 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.

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, the root level rules for well-formed XML documents are not enforced.

This constructor calls System.Xml.XmlTextReader(context.NameTable) or, if context is null, System.Xml.XmlTextReader(newSystem.Xml.NameTable()) to initialize properties of the class. Afterwards, 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, the encoding corresponding to the byte-order mark at the beginning of the stream or, if no byte-order mark is found, UTF-8.
Namespacestrue.
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