/
aprogrammer
/
dotnet-docs
Обзор
Документация
Войти
/
aprogrammer
/
dotnet-docs
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
samples/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp
36 строк
973 B
Andy De George
Move snippets from samples repo to this repo (#17296)
03 мар 2020, 19:23
Не верифицирован
03 мар 2020, 19:23
dbbeda1
Код
Авторство
О чём код?
//<snippet1> #using <System.Xml.dll> using namespace System; using namespace System::Xml; using namespace System::Xml::Schema; static void booksSettingsValidationEventHandler( Object^ /*sender*/, ValidationEventArgs^ e ) { if ( e->Severity == XmlSeverityType::Warning ) { Console::Write( L"WARNING: " ); Console::WriteLine( e->Message ); } else if ( e->Severity == XmlSeverityType::Error ) { Console::Write( L"ERROR: " ); Console::WriteLine( e->Message ); } } int main() { XmlReaderSettings^ booksSettings = gcnew XmlReaderSettings; booksSettings->Schemas->Add( L"http://www.contoso.com/books", L"books.xsd" ); booksSettings->ValidationType = ValidationType::Schema; booksSettings->ValidationEventHandler += gcnew ValidationEventHandler( booksSettingsValidationEventHandler ); XmlReader^ books = XmlReader::Create( L"books.xml", booksSettings ); while ( books->Read() ) {} return 0; } //</snippet1>