- Xml Schema. Read Метод
- Определение
- Перегрузки
- Read(Stream, ValidationEventHandler)
- Параметры
- Возвращаемое значение
- Исключения
- Применяется к
- Read(TextReader, ValidationEventHandler)
- Параметры
- Возвращаемое значение
- Изменение XML-схем Editing XML Schemas
- Изменение схемы XML Editing an XML Schema
- Пример элемента PhoneNumber PhoneNumber Element Example
- Пример атрибута Title Title Attribute Example
- Справочник по XML конфигурации назначенного доступа (терминалу) Assigned Access configuration (kiosk) XML reference
- Полный пример XML Full XML sample
- Пример XML только для терминала Kiosk only sample XML
- Пример XML автозапуска Auto Launch Sample XML
- [Предварительная версия] Пример XML глобального профиля [Preview] Global Profile Sample XML
- [Предварительная версия] XML-пример доступа к папке [Preview] Folder Access sample xml
- XSD для XML-файла конфигурации AssignedAccess XSD for AssignedAccess configuration XML
Xml Schema. Read Метод
Определение
Считывает схему XML. Reads an XML Schema.
Перегрузки
Считывает XML-схему из указанного потока. Reads an XML Schema from the supplied stream.
Считывает схему XML из предоставленного объекта TextReader. Reads an XML Schema from the supplied TextReader.
Считывает схему XML из предоставленного объекта XmlReader. Reads an XML Schema from the supplied XmlReader.
Read(Stream, ValidationEventHandler)
Считывает XML-схему из указанного потока. Reads an XML Schema from the supplied stream.
Параметры
Предоставленный поток данных. The supplied data stream.
Обработчик событий проверки, получающий сведения о синтаксических ошибках схемы XML. The validation event handler that receives information about XML Schema syntax errors.
Возвращаемое значение
Объект XmlSchema, представляющий схему XML. The XmlSchema object representing the XML Schema.
Исключения
Применяется к
Read(TextReader, ValidationEventHandler)
Считывает схему XML из предоставленного объекта TextReader. Reads an XML Schema from the supplied TextReader.
Параметры
Объект TextReader , содержащий схему XML, которую необходимо считать. The TextReader containing the XML Schema to read.
Обработчик событий проверки, получающий сведения о синтаксических ошибках схемы XML. The validation event handler that receives information about the XML Schema syntax errors.
Возвращаемое значение
Объект XmlSchema, представляющий схему XML. The XmlSchema object representing the XML Schema.
Изменение XML-схем Editing XML Schemas
Изменение схем XML является одной из самых важных возможностей модели SOM. Editing an XML schema is one of the most important features of the Schema Object Model (SOM). Все свойства модели SOM, относящиеся к работе перед компиляцией схемы, можно использовать для изменения существующих значений в схеме XML. All of the pre-schema-compilation properties of the SOM can be used to change the existing values in an XML schema. Затем можно повторно скомпилировать схему XML, чтобы изменения вступили в силу. The XML schema can then be recompiled to reflect the changes.
Первым шагом в изменении схемы, загруженной в модель SOM, является обзор схемы. The first step in editing a schema loaded into the SOM is to traverse the schema. Перед изменением схемы следует ознакомиться с обзором схемы, в котором используется API модели SOM. You should be familiar with traversing a schema using the SOM API before you attempt to edit a schema. Также следует ознакомиться со свойствами информационного набора PSCI, относящиеся к работе перед компиляцией схемы и после нее. You should also be familiar with the pre- and post-schema-compilation properties of the Post-Schema-Compilation-Infoset (PSCI).
Изменение схемы XML Editing an XML Schema
В этом разделе приводятся два примера кода, в которых изменяется пользовательская схема, созданная в руководстве по созданию схем XML. In this section, two code examples are provided, both of which edit the customer schema created in the Building XML Schemas topic. В первом примере кода добавляется новый элемент PhoneNumber в элемент Customer , а во втором примере кода добавляется новый атрибут Title в элемент FirstName . The first code example adds a new PhoneNumber element to the Customer element and the second code example adds a new Title attribute to the FirstName element. В первом образце для обзора пользовательской схемы используется коллекция XmlSchema.Elements типа «после компиляции схемы», а во втором примере кода используется коллекция XmlSchema.Items типа «перед компиляцией схемы». The first sample also uses the post-schema-compilation XmlSchema.Elements collection as the means of traversing the customer schema while the second code example uses the pre-schema-compilation XmlSchema.Items collection.
Пример элемента PhoneNumber PhoneNumber Element Example
В первом примере кода добавляется новый элемент PhoneNumber в элемент Customer пользовательской схемы. This first code example adds a new PhoneNumber element to the Customer element of the customer schema. Пример кода изменяет пользовательскую схему посредством следующих шагов. The code example edits the customer schema in the following steps.
Добавление пользовательской схемы в новый объект XmlSchemaSet, а затем ее компиляция. Adds the customer schema to a new XmlSchemaSet object and then compiles it. Любые предупреждения и ошибки проверки схемы, обнаруженные в процессе ее чтения или компиляции, обрабатываются делегатом ValidationEventHandler. Any schema validation warnings and errors encountered reading or compiling the schema are handled by the ValidationEventHandler delegate.
Получение скомпилированного объекта XmlSchema из XmlSchemaSet путем итерации по свойству Schemas. Retrieves the compiled XmlSchema object from the XmlSchemaSet by iterating over the Schemas property. Так как схема компилируется, свойства Post-Schema-Compilation-Infoset (PSCI) доступны. Because the schema is compiled, Post-Schema-Compilation-Infoset (PSCI) properties are accessible.
Создание элемента PhoneNumber с использованием класса XmlSchemaElement, ограничение простого типа xs:string с использованием классов XmlSchemaSimpleType и XmlSchemaSimpleTypeRestriction, добавление аспекта шаблона в свойство Facets ограничения, добавление ограничения в свойство Content простого типа и добавление простого типа в свойство SchemaType элемента PhoneNumber . Creates the PhoneNumber element using the XmlSchemaElement class, the xs:string simple type restriction using the XmlSchemaSimpleType and XmlSchemaSimpleTypeRestriction classes, adds a pattern facet to the Facets property of the restriction, and adds the restriction to the Content property of the simple type and the simple type to the SchemaType of the PhoneNumber element.
Проход по всем элементам XmlSchemaElement в коллекции Values для коллекции XmlSchema.Elements типа «после компиляции схемы». Iterates over each XmlSchemaElement in the Values collection of the post-schema-compilation XmlSchema.Elements collection.
Если свойство QualifiedName элемента имеет значение «Customer» , возвращается сложный тип элемента Customer с использованием класса XmlSchemaComplexType и примитив sequence сложного типа с использованием класса XmlSchemaSequence. If the QualifiedName of the element is «Customer» , gets the complex type of the Customer element using the XmlSchemaComplexType class and the sequence particle of the complex type using the XmlSchemaSequence class.
Добавление нового элемента PhoneNumber в последовательность, содержащую существующие элементы FirstName и LastName , с использованием коллекции Items типа «перед компиляцией схемы» для последовательности. Adds the new PhoneNumber element to the sequence containing the existing FirstName and LastName elements using the pre-schema-compilation Items collection of the sequence.
Наконец, повторная обработка и компиляция измененного объекта XmlSchema с помощью методов Reprocess и Compile класса XmlSchemaSet и запись его в консоль. Finally, reprocesses and compiles the modified XmlSchema object using the Reprocess and Compile methods of the XmlSchemaSet class and writes it to the console.
Ниже приведен полный пример кода. The following is the complete code example.
Ниже приведена измененная пользовательская схема XML. The following is the modified customer schema created in the Building XML Schemas topic.
Пример атрибута Title Title Attribute Example
Во втором примере кода добавляется новый атрибут Title в элемент FirstName пользовательской схемы. This second code example, adds a new Title attribute to the FirstName element of the customer schema. В первом примере кода элемент FirstName имеет тип xs:string . In the first code example, the type of the FirstName element is xs:string . Чтобы элемент FirstName имел атрибут со строковым содержимым, его тип необходимо изменить на сложный тип с простым расширением содержимого в модели содержимого. For the FirstName element to have an attribute along with string content, its type must be changed to a complex type with a simple content extension content model.
Пример кода изменяет пользовательскую схему посредством следующих шагов. The code example edits the customer schema in the following steps.
Добавление пользовательской схемы в новый объект XmlSchemaSet, а затем ее компиляция. Adds the customer schema to a new XmlSchemaSet object and then compiles it. Любые предупреждения и ошибки проверки схемы, обнаруженные в процессе ее чтения или компиляции, обрабатываются делегатом ValidationEventHandler. Any schema validation warnings and errors encountered reading or compiling the schema are handled by the ValidationEventHandler delegate.
Получение скомпилированного объекта XmlSchema из XmlSchemaSet путем итерации по свойству Schemas. Retrieves the compiled XmlSchema object from the XmlSchemaSet by iterating over the Schemas property. Так как схема компилируется, свойства Post-Schema-Compilation-Infoset (PSCI) доступны. Because the schema is compiled, Post-Schema-Compilation-Infoset (PSCI) properties are accessible.
Создание нового сложного типа для элемента FirstName с использованием класса XmlSchemaComplexType. Creates a new complex type for the FirstName element using the XmlSchemaComplexType class.
Создание нового простого расширения содержимого с базовым типом xs:string с использованием классов XmlSchemaSimpleContent и XmlSchemaSimpleContentExtension. Creates a new simple content extension, with a base type of xs:string , using the XmlSchemaSimpleContent and XmlSchemaSimpleContentExtension classes.
Создание нового атрибута Title с использованием класса XmlSchemaAttribute со значением SchemaTypeName для xs:string , и добавление атрибута в простое расширение содержимого. Creates the new Title attribute using the XmlSchemaAttribute class, with a SchemaTypeName of xs:string and adds the attribute to the simple content extension.
Установка простого расширения содержимого для модели простого содержимого и простого содержимого для модели сложного типа. Sets the content model of the simple content to the simple content extension and the content model of the complex type to the simple content.
Добавление нового сложного типа в коллекцию XmlSchema.Items типа «перед компиляцией схемы». Adds the new complex type to the pre-schema-compilation XmlSchema.Items collection.
Выполнение итерации по каждому XmlSchemaObject в коллекции XmlSchema.Items перед компиляцией схемы. Iterates over each XmlSchemaObject in the pre-schema-compilation XmlSchema.Items collection.
Поскольку элемент FirstName не является глобальным в схеме, он недоступен в коллекциях XmlSchema.Items и XmlSchema.Elements. Because the FirstName element is not a global element in the schema, it is not available in the XmlSchema.Items or XmlSchema.Elements collections. Пример кода определяет расположение элемента FirstName по расположению элемента Customer . The code example locates the FirstName element by first locating the Customer element.
В первом примере кода обзор схемы выполняется с помощью коллекции XmlSchema.Elements типа «после компиляции схемы». The first code example traversed the schema using the post-schema-compilation XmlSchema.Elements collection. В этом образце для обзора схемы используется коллекция XmlSchema.Items типа «перед компиляцией схемы». In this sample, the pre-schema-compilation XmlSchema.Items collection is used to traverse the schema. Обе коллекции предоставляют доступ к глобальным элементам схемы, но проход по коллекции Items занимает больше времени, поскольку необходимо проходить по всем глобальным элементам в схеме, а в схеме отсутствуют свойства PSCI. While both collections provide access to the global elements in the schema, iterating through the Items collection is more time consuming because you must iterate over all global elements in the schema and it does not have any PSCI properties. Коллекции PSCI (XmlSchema.Elements, XmlSchema.Attributes, XmlSchema.SchemaTypes и т. д.) предоставляют прямой доступ к своим глобальным элементам, атрибутам, типам и их свойствам PSCI. The PSCI collections (XmlSchema.Elements, XmlSchema.Attributes, XmlSchema.SchemaTypes, and so on) provide direct access to their global elements, attributes, and types and their PSCI properties.
Если объект XmlSchemaObject является элементом, значением QualifiedName которого является «Customer» , возвращается сложный тип элемента Customer с использованием класса XmlSchemaComplexType и примитив sequence сложного типа с использованием класса XmlSchemaSequence. If the XmlSchemaObject is an element, whose QualifiedName is «Customer» , gets the complex type of the Customer element using the XmlSchemaComplexType class and the sequence particle of the complex type using the XmlSchemaSequence class.
Выполнение итерации по каждому XmlSchemaParticle в коллекции XmlSchemaSequence.Items перед компиляцией схемы. Iterates over each XmlSchemaParticle in the pre-schema-compilation XmlSchemaSequence.Items collection.
Если объект XmlSchemaParticle является элементом, значением QualifiedName которого является «FirstName» , в свойстве SchemaTypeName элемента FirstName задается новый сложный тип FirstName . If the XmlSchemaParticle is an element, who’s QualifiedName is «FirstName» , sets the SchemaTypeName of the FirstName element to the new FirstName complex type.
Наконец, повторная обработка и компиляция измененного объекта XmlSchema с помощью методов Reprocess и Compile класса XmlSchemaSet и запись его в консоль. Finally, reprocesses and compiles the modified XmlSchema object using the Reprocess and Compile methods of the XmlSchemaSet class and writes it to the console.
Ниже приведен полный пример кода. The following is the complete code example.
Ниже приведена измененная пользовательская схема XML. The following is the modified customer schema created in the Building XML Schemas topic.
Справочник по XML конфигурации назначенного доступа (терминалу) Assigned Access configuration (kiosk) XML reference
Относится к: Applies to
Полный пример XML Full XML sample
Обновлено для Windows 10 версии 1903 и Windows 10 Insider Preview (сборки 19H2, 20H1). Updated for Windows 10, version 1903, and Windows 10 Insider Preview (19H2, 20H1 builds).
Пример XML только для терминала Kiosk only sample XML
Пример XML автозапуска Auto Launch Sample XML
В этом примере показано, что приложения UWP и Win32 можно настроить для автоматического запуска при входе в систему учетной записи с установленным доступом. This sample demonstrates that both UWP and Win32 apps can be configured to automatically launch, when assigned access account logs in. Для одного профиля может быть настроено не более одного приложения для автоматического запуска. One profile can have at most one app configured for auto launch. AutoLaunchArguments передаются приложениям в обычном режиме, и приложению необходимо явным образом обрабатывать аргументы. AutoLaunchArguments are passed to the apps as is and the app needs to handle the arguments explicitly.
[Предварительная версия] Пример XML глобального профиля [Preview] Global Profile Sample XML
Глобальный профиль в настоящее время поддерживается в Windows 10 Insider Preview (сборки 20H1). Global Profile is currently supported in Windows 10 Insider Preview (20H1 builds). Глобальный профиль предназначен для сценариев, в которых у пользователя нет специального профиля, но ИТ-администратор по-прежнему хочет, чтобы пользователь запускался в режиме блокировки или использовался в качестве меры, когда профиль не может быть определен для пользователя. Global Profile is designed for scenarios where a user does not have a designated profile, yet IT Admin still wants the user to run in lockdown mode, or used as mitigation when a profile cannot be determined for a user.
В этом примере показано, что используется только глобальный профиль, активный пользователь не настроен. This sample demonstrates that only a global profile is used, no active user configured. Глобальный профиль будет применяться при входе в систему каждой учетной записи, не от имени администратора Global profile will be applied when every non-admin account logs in
В приведенном ниже примере показано, как использовать выделенный профиль и глобальное смешанное использование профилей. Пользователь будет использовать один профиль, а все остальные пользователи, не администраторы, будут использовать другой профиль. Below sample shows dedicated profile and global profile mixed usage, a user would use one profile, everyone else that’s non-admin will use another profile.
[Предварительная версия] XML-пример доступа к папке [Preview] Folder Access sample xml
В Windows 10 версии 1809 доступ к папок блокируется, поэтому при открытом общем диалоговом оке файла ИТ-администратор может указать, есть ли у пользователя доступ к папке «Загрузки» или нет доступа к какой-либо папке вообще. In Windows 10, version 1809, folder access is locked down so that when common file dialog is opened, IT Admin can specify if the user has access to the Downloads folder, or no access to any folder at all. Это ограничение было изменено для более точной детализации и более простого использования и доступно в Windows 10 Insider Preview (сборки 19H2, 20H1). This restriction has been redesigned for finer granulatity and easier use, and is available in Windows 10 Insider Preview (19H2, 20H1 builds).
ИТ-администратор теперь может указать доступ пользователей к папке «Загрузки», съемным дискам или вообще не иметь ограничений. IT Admin now can specify user access to Downloads folder, Removable drives, or no restrictions at all. Загрузки и съемные диски могут быть разрешены одновременно. Downloads and Removable Drives can be allowed at the same time.
XSD для XML-файла конфигурации AssignedAccess XSD for AssignedAccess configuration XML
Обновлено для Windows 10 версии 1903 и Windows 10 Insider Preview (сборки 19H2, 20H1). Updated for Windows 10, version 1903 and Windows 10 Insider Preview (19H2, 20H1 builds). Ниже приведена схема конфигурации AssignedAccess до выпуска Windows 10 1803. Below schema is for AssignedAccess Configuration up to Windows 10 1803 release.
Ниже представлена схема новых функций, представленная в выпуске Windows 10 1809 Here is the schema for new features introduced in Windows 10 1809 release
Схема для Windows 10 Insider Preview (сборки 19H2, 20H1) Schema for Windows 10 Insider Preview (19H2, 20H1 builds)
Для авторизации совместимого XML-документа конфигурации, который включает элементы и атрибуты из Windows 10 версии 1809 или более новой версии, всегда включайте пространство имен этих схем надстроек и соответствующим образом украсьте атрибуты и элементы псевдонимом пространства имен. To authorize a compatible configuration XML that includes elements and attributes from Windows 10, version 1809 or newer, always include the namespace of these add-on schemas, and decorate the attributes and elements accordingly with the namespace alias. Например, чтобы настроить функцию автозапуска, добавленную в Windows 10 версии 1809, используйте следующий пример. For example, to configure the autolaunch feature that was added in Windows 10, version 1809, use the following sample. Обратите внимание, что псевдоним r1809 присваивается пространству имен 201810 для Windows 10 версии 1809, а псевдоним отмечен в autoLaunch и AutoLaunchArguments в режиме inline. Notice an alias r1809 is given to the 201810 namespace for Windows 10, version 1809, and the alias is tagged on AutoLaunch and AutoLaunchArguments inline.