ConformanceLevel Перечисление

Определение

Specifies the amount of input or output checking that XmlReader and XmlWriter objects perform.Specifies the amount of input or output checking that XmlReader and XmlWriter objects perform.

public enum class ConformanceLevel
public enum ConformanceLevel
type ConformanceLevel = 
Public Enum ConformanceLevel
Наследование
ConformanceLevel

Поля

Auto 0

The XmlReader or XmlWriter object automatically detects whether document-level or fragment-level checking should be performed, and does the appropriate checking.The XmlReader or XmlWriter object automatically detects whether document-level or fragment-level checking should be performed, and does the appropriate checking. If you're wrapping another XmlReader or XmlWriter object, the outer object doesn't do any additional conformance checking.If you're wrapping another XmlReader or XmlWriter object, the outer object doesn't do any additional conformance checking. Conformance checking is left up to the underlying object.Conformance checking is left up to the underlying object.

See the ConformanceLevel and ConformanceLevel properties for details on how the compliance level is determined.See the ConformanceLevel and ConformanceLevel properties for details on how the compliance level is determined.

Document 2

The XML data complies with the rules for a well-formed XML 1.0 document, as defined by the W3C.The XML data complies with the rules for a well-formed XML 1.0 document, as defined by the W3C. This level of checking ensures that the stream being read or written can be consumed by any processor as an XML 1.0 document.This level of checking ensures that the stream being read or written can be consumed by any processor as an XML 1.0 document.

Fragment 1

The XML data is a well-formed XML fragment, as defined by the W3C.The XML data is a well-formed XML fragment, as defined by the W3C. This conformance level represents an XML document that might not have a root element but is otherwise well-formed.This conformance level represents an XML document that might not have a root element but is otherwise well-formed. This level of checking ensures that the stream being read or written can be consumed by any processor as an XML 1.0 external parsed entity].This level of checking ensures that the stream being read or written can be consumed by any processor as an XML 1.0 external parsed entity].

Комментарии

При создании экземпляра модуля чтения или записи XML можно использовать класс XmlReaderSettings или XmlWriterSettings, чтобы указать функции, которые должен поддерживать новый экземпляр.When you create an XML reader or writer instance, you can use the XmlReaderSettings or XmlWriterSettings class to specify the features that you want the new instance to support. Одной из функций, которые можно настроить, является уровень соответствия, который необходимо применить к XML-данным.One of the features that you can configure is the level of conformance you want to enforce on the XML data.

Создание совместимого модуля чтения или записи гарантирует, что обрабатываемые XML-данные будут соответствовать заданному уровню соответствия.Creating a compliant reader or writer guarantees that the XML data being processed complies with the specified conformance level. Если считываемый или записываемый поток не соответствует уровню соответствия, создается исключение.If the stream being read or written doesn't comply with the conformance level, an exception is thrown.

Проверки на уровне документа с помощью члена перечисления ConformanceLevel.Document применяют проверки на уровне фрагментов (элемент ConformanceLevel.Fragment), а также гарантирует следующее:Document-level checks with the ConformanceLevel.Document enumeration member enforce fragment-level checks (the ConformanceLevel.Fragment member) and also ensure the following:

  • У элемента верхнего уровня нет ни одного узла, кроме объявления XML, DTD, элемента, комментария, пробела или инструкции по обработке.The top-level item doesn't have any nodes other than the XML declaration, DTD, element, comment, white space, or processing instruction.

  • XML-данные имеют один и только один узел элемента верхнего уровня.The XML data has one and only one top-level element node.

Применяется к

Дополнительно