public Compiler(XmlSchema schema) { this._schema = schema; // The Compile method will throw errors encountered on compiling the schema XmlSchemaSet xset = new XmlSchemaSet(); xset.Add(_schema); xset.ValidationEventHandler += StrictValidationCallback; xset.Compile(); XmlSchemaElement e = null; foreach (XmlSchemaElement elem in _schema.Elements.Values) { if (elem.Name == $"{_xmlInfo.GetXmlMainElementName()}") { e = elem; break; } } if (e == null) { throw new XmlBinaryConverterException($"No element named {_xmlInfo.GetXmlMainElementName()} can be found in the schema"); } Info = new CompoundField($"{_xmlInfo.GetXmlMainElementName()}", 1); ProcessSchemaObject(Info, null, e, 1); }
protected ACompilerInfoField(string name) { var prefix = _xmlInfo.GetXmlNamespacePrefix(); XPath = ""; foreach (string s in name.Split('.')) { XPath += "/" + (prefix == "" ? "" : prefix + ":") + s; } this.CName = XPath.Replace("/" + prefix + ":", "_").Replace("[", "").Replace("]", "_").Replace($"_{_xmlInfo.GetXmlMainElementName()}_", "").Replace("__", ""); }