------------------------------------------------------------------------------ -- XML/Ada - An XML suite for Ada95 -- -- -- -- Copyright (C) 2004-2012, AdaCore -- -- -- -- This library is free software; you can redistribute it and/or modify it -- -- under terms of the GNU General Public License as published by the Free -- -- Software Foundation; either version 3, or (at your option) any later -- -- version. This library is distributed in the hope that it will be useful, -- -- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- -- -- -- -- -- -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- . -- -- -- ------------------------------------------------------------------------------ with Sax.Encodings; with Sax.Readers; use Sax.Readers; with Schema.Validators; use Schema.Validators; with Schema.Schema_Readers; use Schema.Schema_Readers; with Input_Sources.Strings; use Input_Sources.Strings; package body Schema.Validators.XSD_Grammar is -- The following metaschema is generated by ./cleanup_schema, which parses -- the normative schema.xsd and datatypes.xsd files. -- Embedding the string avoids relying on external files when running -- XML/Ada based applications pragma warnings (Off); pragma style_checks (Off); Metaschema : aliased constant String := ""; pragma style_checks (On); pragma warnings (On); procedure Add_Schema_For_Schema (R : in out Schema.Validators.abstract_validation_reader'class) is Schema : schema_reader; Input : string_input; begin if Debug then Debug_Output ("Add metaschema to the grammar"); end if; Set_Grammar (Schema, R.Grammar); Set_Feature (Schema, Schema_Validation_Feature, False); Open (Metaschema'access, Encoding => Sax.Encodings.Encoding, Input => Input); Parse (Schema, Input); Close (Input); exception when XML_Not_Implemented | XML_Validation_Error => R.Error_Msg := Schema.Error_Msg; R.Error_Location := Schema.Error_Location; raise; end Add_Schema_For_Schema; end Schema.Validators.XSD_Grammar;