public static void LoadSchemaAndValidateDoc(this XDocument doc, ISchemaMap schemaMap, string schemaRootPath) { var xmlNamespace = doc.GetDefaultSchemaNamespace(); if (!schemaMap.Mapping.ContainsKey(xmlNamespace.NamespaceName)) { throw new InvalidOperationException($"Namespace mapping not configured: {xmlNamespace.NamespaceName}"); } var schemaPath = Path.Combine(schemaRootPath, schemaMap.Mapping[xmlNamespace.NamespaceName]); var reader = new XmlTextReader(schemaPath); var schema = XmlSchema.Read(reader, ValidationCallback); var schemaSet = new XmlSchemaSet(); schemaSet.Add(schema); doc.Validate(schemaSet, ValidationCallback); }
public EdgeSerializer(ISchemaMap schemaMap = default(ISchemaMap)) { this.Map = schemaMap ?? new AttributeSchemaMap(); }
public Client(ISchemaMap schemaMap) { _schemaMap = schemaMap ?? throw new ArgumentNullException(nameof(schemaMap)); }