//------------------------------------------------------------------------------- //------------------------------------------------------------------------------- internal XbrlSchema(XbrlFragment ContainingXbrlFragment, string SchemaFilename, string BaseDirectory) { this.Fragment = ContainingXbrlFragment; this.Path = GetFullSchemaPath(SchemaFilename, BaseDirectory); try { thisXmlSchema = Container.Resolve <ISchema>(); thisXmlSchemaSet = Container.Resolve <ISchemaSet>(); if (thisXmlSchema.Read(this.Path) == false) { StringBuilder MessageBuilder = new StringBuilder(); string StringFormat = AssemblyResources.GetName("SchemaFileCandidateDoesNotContainSchemaRootNode"); MessageBuilder.AppendFormat(StringFormat, this.Path); this.Fragment.AddValidationError(new SchemaValidationError(this, MessageBuilder.ToString())); return; } thisXmlSchemaSet.Add(thisXmlSchema); thisXmlSchemaSet.Compile(); } catch (FileNotFoundException fnfEx) { StringBuilder MessageBuilder = new StringBuilder(); string StringFormat = AssemblyResources.GetName("FileNotFoundDuringSchemaCreation"); MessageBuilder.AppendFormat(StringFormat, this.Path); this.Fragment.AddValidationError(new SchemaValidationError(this, MessageBuilder.ToString(), fnfEx)); return; } catch (WebException webEx) { StringBuilder MessageBuilder = new StringBuilder(); string StringFormat = AssemblyResources.GetName("WebExceptionThrownDuringSchemaCreation"); MessageBuilder.AppendFormat(StringFormat, this.Path); this.Fragment.AddValidationError(new SchemaValidationError(this, MessageBuilder.ToString(), webEx)); return; } thisSchemaDocument = Container.Resolve <IDocument>(); this.thisLinkbaseDocuments = new List <LinkbaseDocument>(); this.RoleTypes = new List <RoleType>(); thisSchemaDocument.Load(this.Path); this.NamespaceManager = Container.Resolve <INamespaceManager>(); this.NamespaceManager.Document = thisSchemaDocument; this.NamespaceManager.AddNamespace("schema", XbrlSchema.XmlSchemaNamespaceUri); ReadSchemaNode(); ReadSimpleTypes(); ReadComplexTypes(); ReadElements(); LookForAnnotations(); }
/// <summary> /// Reads a schema and compiles it into a schema set. /// </summary> /// <remarks> /// This code may throw exceptions. Exception handling is the responsibility of the caller. /// </remarks> /// <param name="schemaPath"> /// The path of the schema to read. /// </param> /// <returns> /// True if the load was successful, false if the file is not a schema file. /// </returns> private bool ReadAndCompile(string schemaPath) { thisXmlSchema = Container.Resolve <ISchema>(); thisXmlSchemaSet = Container.Resolve <ISchemaSet>(); if (thisXmlSchema.Read(schemaPath) == false) { StringBuilder MessageBuilder = new StringBuilder(); string StringFormat = AssemblyResources.GetName("SchemaFileCandidateDoesNotContainSchemaRootNode"); MessageBuilder.AppendFormat(StringFormat, schemaPath); this.Fragment.AddValidationError(new SchemaValidationError(this, MessageBuilder.ToString())); return(false); } thisXmlSchemaSet.Add(thisXmlSchema); thisXmlSchemaSet.Compile(); return(true); }
/// <summary> /// ctor /// </summary> /// <param name="schemaSet"></param> public SoapValidator(ISchemaSet schemaSet) { mSchemas = schemaSet; ValidationErrors = new List <String>(); }