/// <summary> /// Extracts the data from the DOM tree below the indicated context /// <see cref="XmlElement"/> and create a suitable <see crel="Release"/> /// structure to add to the indicated <see cref="Specification"/>. /// </summary> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="context">The context <see cref="XmlElement"/> containing data</param> /// <param name="loadedSchemas">A dictionary of all ready loaded schemas.</param> public virtual void LoadData(Specification specification, XmlElement context, Dictionary<string, SchemaRelease> loadedSchemas) { new DTDRelease (specification, GetVersion (context), GetPublicId (context), GetSystemId (context), GetRootElement (context)); }
/// <summary> /// Constructs a <b>DTDRelease</b> instance describing a DTD /// based release of a particular <see cref="Specification"/>. /// </summary> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="version">The version identifier for this release.</param> /// <param name="publicId">The public name for the DTD.</param> /// <param name="systemId">The system name for the DTD.</param> /// <param name="rootElements">The set of possible root element.</param> public DTDRelease(Specification specification, string version, string publicId, string systemId, string [] rootElements) : base(specification, version, rootElements) { this.publicId = publicId; this.systemId = systemId; }
/// <summary> /// Constructs a <b>Release</b> instance and associates it with the /// indicated <see cref="Specification"/>. /// </summary> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="version">The version identifier for this release.</param> /// <param name="rootElements">The set of possible root element.</param> protected Release(Specification specification, string version, string [] rootElements) { this.specification = specification; this.version = version; this.rootElements = rootElements; specification.Add (this); }
/// <summary> /// Extracts the data from the DOM tree below the indicated context /// <see cref="XmlElement"/> and create a suitable <see crel="Release"/> /// structure to add to the indicated <see cref="Specification"/>. /// </summary> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="context">The context <see cref="XmlElement"/> containing data</param> /// <param name="loadedSchemas">A dictionary of all ready loaded schemas.</param> public virtual void LoadData(Specification specification, XmlElement context, Dictionary<string, SchemaRelease> loadedSchemas) { XmlAttribute id = context.GetAttributeNode ("id"); SchemaRelease release = new SchemaRelease (specification, GetVersion (context), GetNamespaceUri (context), GetSchemaLocation (context), GetPreferredPrefix (context), GetAlternatePrefix (context), GetRootElements (context)); HandleImports (release, context, loadedSchemas); if (id != null) loadedSchemas.Add (id.Value, release); }
/// <summary> /// Bootstrap the entire collection of specifications by processing the /// contents of the 'files/releases.xml' file. /// </summary> static Specification() { Dictionary<string, SchemaRelease> loadedSchemas = new Dictionary<string,SchemaRelease> (); log.Debug ("Bootstrapping Specifications"); try { FileStream stream = new FileStream ( Application.PathTo ( ConfigurationManager.AppSettings ["HandCoded.FpML Toolkit.Releases"]), FileMode.Open); XmlDocument document = XmlUtility.NonValidatingParse (stream); foreach (XmlElement context in XPath.Paths (document.DocumentElement, "specification")) { XmlElement name = XPath.Path (context, "name"); Specification specification = new Specification (Types.ToToken (name)); foreach (XmlElement node in XPath.Paths (context, "dtdRelease")) GetDtdReleaseLoader (node).LoadData (specification, node, loadedSchemas); foreach (XmlElement node in XPath.Paths (context, "schemaRelease")) GetSchemaReleaseLoader (node).LoadData (specification, node, loadedSchemas); } stream.Close (); } catch (Exception error) { log.Fatal ("Unable to load specifications", error); } log.Debug ("Completed"); }
/// <summary> /// Constructs a <b>SchemaRelease</b> instance describing a schema /// based release of a particular <see cref="Specification"/>. /// </summary> /// <remarks>This constructor should be used when creating a description of a /// schema that has multiple root elements.</remarks> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="version">The version identifier for this release.</param> /// <param name="namespaceUri">The namespace used to identify the schema.</param> /// <param name="schemaLocation">The default schema location.</param> /// <param name="preferredPrefix">The preferred prefix for the namespace.</param> /// <param name="alternatePrefix">The alternate prefix for the namespace.</param> /// <param name="initialiser">The <see cref="InstanceInitialiser"/>.</param> /// <param name="recogniser">The <see cref="SchemaRecogniser"/>.</param> /// <param name="rootElements">The set of possible root elements.</param> public SchemaRelease(Specification specification, string version, string namespaceUri, string schemaLocation, string preferredPrefix, string alternatePrefix, InstanceInitialiser initialiser, SchemaRecogniser recogniser, string [] rootElements) : base(specification, version, rootElements) { this.namespaceUri = namespaceUri; this.schemaLocation = schemaLocation; this.preferredPrefix = preferredPrefix; this.alternatePrefix = alternatePrefix; this.initialiser = initialiser; this.recogniser = recogniser; }
/// <summary> /// Constructs a <b>SchemaRelease</b> instance describing a schema /// based release of a particular <see cref="Specification"/>. /// </summary> /// <remarks>This constructor should be used when creating a description of a /// schema that has multiple root elements.</remarks> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="version">The version identifier for this release.</param> /// <param name="namespaceUri">The namespace used to identify the schema.</param> /// <param name="schemaLocation">The default schema location.</param> /// <param name="preferredPrefix">The preferred prefix for the namespace.</param> /// <param name="alternatePrefix">The alternate prefix for the namespace.</param> /// <param name="rootElements">The set of possible root elements.</param> public SchemaRelease(Specification specification, string version, string namespaceUri, string schemaLocation, string preferredPrefix, string alternatePrefix, string [] rootElements) : this(specification, version, namespaceUri, schemaLocation, preferredPrefix, alternatePrefix, new DefaultInstanceInitialiser (), new DefaultSchemaRecogniser (), rootElements) { }
/// <summary> /// Constructs a <b>SchemaRelease</b> instance describing a schema /// based release of a particular <see cref="Specification"/>. /// </summary> /// <remarks>This constructor should be used when creating a description /// of a schema that has only a single root element.</remarks> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="version">The version identifier for this release.</param> /// <param name="namespaceUri">The namespace used to identify the schema.</param> /// <param name="schemaLocation">The default schema location.</param> /// <param name="preferredPrefix">The preferred prefix for the namespace.</param> /// <param name="alternatePrefix">The alternate prefix for the namespace.</param> /// <param name="initialiser">The <see cref="InstanceInitialiser"/>.</param> /// <param name="recogniser">The <see cref="SchemaRecogniser"/>.</param> /// <param name="rootElement">The normal root element.</param> public SchemaRelease(Specification specification, string version, string namespaceUri, string schemaLocation, string preferredPrefix, string alternatePrefix, InstanceInitialiser initialiser, SchemaRecogniser recogniser, string rootElement) : this(specification, version, namespaceUri, schemaLocation, preferredPrefix, alternatePrefix, initialiser, recogniser, new string [] { rootElement }) { }
/// <summary> /// Constructs a <b>SchemaRelease</b> instance describing a schema /// based release of a particular <see cref="Specification"/>. /// </summary> /// <remarks>This constructor should be used when creating a description /// of a schema that has only a single root element.</remarks> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="version">The version identifier for this release.</param> /// <param name="namespaceUri">The namespace used to identify the schema.</param> /// <param name="schemaLocation">The default schema location.</param> /// <param name="preferredPrefix">The preferred prefix for the namespace.</param> /// <param name="alternatePrefix">The alternate prefix for the namespace.</param> /// <param name="rootElement">The normal root element.</param> public SchemaRelease(Specification specification, string version, string namespaceUri, string schemaLocation, string preferredPrefix, string alternatePrefix, string rootElement) : this(specification, version, namespaceUri, schemaLocation, preferredPrefix, alternatePrefix, new string [] { rootElement }) { }
/// <summary> /// Constructs a <b>SchemaRelease</b> instance describing a schema /// based release of a particular <see cref="Specification"/>. /// </summary> /// <remarks>This constructor should be used when creating a description of a /// pure extension schema, i.e. one that contains no useable root elements.</remarks> /// <param name="specification">The owning <see cref="Specification"/>.</param> /// <param name="version">The version identifier for this release.</param> /// <param name="namespaceUri">The namespace used to identify the schema.</param> /// <param name="schemaLocation">The default schema location.</param> /// <param name="preferredPrefix">The preferred prefix for the namespace.</param> /// <param name="alternatePrefix">The alternate prefix for the namespace.</param> public SchemaRelease(Specification specification, string version, string namespaceUri, string schemaLocation, string preferredPrefix, string alternatePrefix) : this(specification, version, namespaceUri, schemaLocation, preferredPrefix, alternatePrefix, (string []) null) { }