/// <summary>
            /// Applies the <b>Conversion</b> to a <see cref="XmlDocument"/> instance
            /// to create a new <see cref="XmlDocument"/>.
            /// </summary>
            /// <param name="source">The <see cref="XmlDocument"/> to be converted.</param>
            /// <param name="helper">A <see cref="IHelper"/> used to guide conversion.</param>
            /// <returns>A new <see cref="XmlDocument"/> containing the transformed data.</returns>
            public override XmlDocument Convert(XmlDocument source, HandCoded.Meta.IHelper helper)
            {
                XmlDocument		target 	= TargetRelease.NewInstance ("FpML");
                XmlElement		oldRoot = source.DocumentElement;
                XmlElement		newRoot	= target.DocumentElement;
                XmlDocumentType doctype = target.DocumentType;

                // Temporarily remove the <!DOCTYPE> from the new document
                target.RemoveChild (doctype);

                // Transfer the scheme default attributes
                foreach (XmlAttribute attr in oldRoot.Attributes) {
                    if (attr.Name.EndsWith ("SchemeDefault")) {
                        string name  = attr.Name;
                        string value = attr.Value;

                        if (Releases.R1_0.SchemeDefaults.GetDefaultUriForAttribute (name).Equals (value))
                            value = Releases.R2_0.SchemeDefaults.GetDefaultUriForAttribute (name);

                        if (value != null) newRoot.SetAttribute (name, null, value);
                    }
                }

                // Transcribe each of the first level child elements
                foreach (XmlNode node in oldRoot.ChildNodes)
                    Transcribe (node, target, newRoot);

                // Replace the <!DOCTYPE>
                target.InsertBefore (doctype, target.DocumentElement);

                return (target);
            }
 /// <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="HandCoded.Meta.Specification"/>.
 /// </summary>
 /// <param name="specification">The owning <see cref="HandCoded.Meta.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 override void LoadData(HandCoded.Meta.Specification specification, XmlElement context,
     Dictionary<string, HandCoded.Meta.SchemaRelease> loadedSchemas)
 {
     new DTDRelease (specification, GetVersion (context),
             GetPublicId (context), GetSystemId (context),
             GetRootElement (context), GetSchemeDefaults (context),
             GetSchemeCollection (context));
 }
 /// <summary>
 /// Constructs a <b>DTDRelease</b> instance describing a DTD
 /// based release of a particular <see cref="HandCoded.Meta.Specification"/>.
 /// </summary>
 /// <param name="specification">The owning <see cref="HandCoded.Meta.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="rootElement">The normal root element.</param>
 /// <param name="schemeDefaults">Scheme default URI information.</param>
 /// <param name="schemeCollection">The SchemeCollection of this release.</param>
 public DTDRelease(HandCoded.Meta.Specification specification, string version,
     string publicId, string systemId, string rootElement,
     SchemeDefaults schemeDefaults, SchemeCollection schemeCollection)
     : base(specification, version, publicId, systemId, rootElement)
 {
     this.schemeDefaults   = schemeDefaults;
     this.schemeCollection = schemeCollection;
 }
        /// <summary>
        /// Constructs a <b>SchemaRelease</b> instance describing a schema
        /// based release of a particular <see cref="HandCoded.Meta.Specification"/>.
        /// </summary>
        /// <param name="specification">The owning <see cref="HandCoded.Meta.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 possible root elements.</param>
        /// <param name="schemeDefaults">Scheme default URI information.</param>
        /// <param name="schemeCollection">The SchemeCollection for this release.</param>
        public SchemaRelease(HandCoded.Meta.Specification specification, string version,
            string namespaceUri, string schemaLocation,	string preferredPrefix,
            string alternatePrefix, string [] rootElements, SchemeDefaults schemeDefaults,
            SchemeCollection schemeCollection)
            : base(specification, version, namespaceUri, schemaLocation,
				preferredPrefix, alternatePrefix, rootElements)
        {
            this.schemeDefaults   = schemeDefaults;
            this.schemeCollection = schemeCollection;
        }
        /// <summary>
        /// Initialises a new <see cref="XmlDocument"/> by adding required definitions to
        /// the structure indicated by its root <see cref="XmlElement"/>.
        /// </summary>
        /// <param name="release">The <see cref="SchemaRelease"/> being initialised.</param>
        /// <param name="root">The root <see cref="XmlElement"/> of the new document.</param>
        /// <param name="isDefaultNamespace"><b>true</b> if the default namespace is being initialised.</param>
        public override void Initialise(HandCoded.Meta.SchemaRelease release, XmlElement root, bool isDefaultNamespace)
        {
            base.Initialise (release, root, isDefaultNamespace);

            int majorVersion = Int32.Parse (release.Version.Split('-')[0]);

            if (majorVersion <= 4)
                root.SetAttribute ("version", release.Version);
            else
                root.SetAttribute("fpmlVersion", release.Version);
        }
        /// <summary>
        /// Determines if the <see cref="XmlDocument"/> could be an instance of the
        /// indicated <see cref="SchemaRelease"/>. Also checks that the FpML version
        /// attribute matches the <see cref="SchemaRelease"/> instance.
        /// </summary>
        /// <param name="release">The potential <see cref="SchemaRelease"/>.</param>
        /// <param name="document">The <see cref="XmlDocument"/> to be tested.</param>
        /// <returns><b>true</b> if the <see cref="XmlDocument"/> could be an
        ///	instance of the indicated <see cref="SchemaRelease"/>.</returns>
        public override bool Recognises(HandCoded.Meta.SchemaRelease release, XmlDocument document)
        {
            if (base.Recognises (release, document)) {
                int majorVersion = Int32.Parse (release.Version.Split('-')[0]);

                if (majorVersion <= 4) {
                    if (document.DocumentElement.GetAttribute ("version").Equals (release.Version))
                        return (true);
                }
                else {
                    if (document.DocumentElement.GetAttribute ("fpmlVersion").Equals (release.Version))
                        return (true);
                }
            }
            return (false);
        }
        /// <summary>
        /// Extracts the data from the DOM tree below the indicated context
        /// <see cref="XmlElement"/> and create a suitable <see cref="HandCoded.Meta.Release"/>
        /// structure to add to the indicated <see cref="HandCoded.Meta.Specification"/>.
        /// </summary>
        /// <param name="specification">The owning <see cref="HandCoded.Meta.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 override void LoadData(HandCoded.Meta.Specification specification, XmlElement context,
            Dictionary<string, HandCoded.Meta.SchemaRelease> loadedSchemas)
        {
            XmlAttribute    id 		= context.GetAttributeNode ("id");

            SchemaRelease release = new SchemaRelease (specification,
                    GetVersion (context), GetNamespaceUri (context),
                    GetSchemaLocation (context), GetPreferredPrefix (context),
                    GetAlternatePrefix (context),
                    new FpMLInstanceInitialiser (),
                    new FpMLSchemaRecogniser (), GetRootElements (context),
                    GetSchemeDefaults (context), GetSchemeCollection (context));

            HandleImports (release, context, loadedSchemas);

            if (id != null) loadedSchemas.Add (id.Value, release);
        }
        /// <summary>
        /// Constructs a <b>SchemaRelease</b> instance describing a schema
        /// based release of a particular <see cref="HandCoded.Meta.Specification"/>.
        /// </summary>
        /// <param name="specification">The owning <see cref="HandCoded.Meta.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="HandCoded.Meta.InstanceInitialiser"/>.</param>
        /// <param name="recogniser">The <see cref="HandCoded.Meta.SchemaRecogniser"/>.</param>
        /// <param name="rootElement">The normal root element.</param>
        /// <param name="schemeDefaults">Scheme default URI information.</param>
        /// <param name="schemeCollection">The SchemeCollection for this release.</param>
        public SchemaRelease(HandCoded.Meta.Specification specification, string version,
            string namespaceUri, string schemaLocation,	string preferredPrefix,
            string alternatePrefix, HandCoded.Meta.InstanceInitialiser initialiser,
            HandCoded.Meta.SchemaRecogniser recogniser, string rootElement,
            SchemeDefaults schemeDefaults, SchemeCollection schemeCollection)
            : base(specification, version, namespaceUri, schemaLocation,
				preferredPrefix, alternatePrefix, initialiser, recogniser, rootElement)
        {
            this.schemeDefaults   = schemeDefaults;
            this.schemeCollection = schemeCollection;
        }
            private void Transcribe(XmlNode context, XmlDocument document, XmlNode parent, HandCoded.Meta.IHelper helper)
            {
                switch (context.NodeType) {
                case XmlNodeType.Element:
                    {
                        XmlElement		element = context as XmlElement;
                        XmlElement		clone;

                        // Ignore failureToDeliverApplication
                        if (element.LocalName.Equals ("failureToDeliverApplicable"))
                            break;

                        // Handle elements that get renamed.
                        if (element.LocalName.Equals ("equityOptionFeatures"))
                            clone = document.CreateElement ("equityFeatures");
                        else if (element.LocalName.Equals ("automaticExerciseApplicable"))
                            clone = document.CreateElement ("automaticExercise");
                        else if (element.LocalName.Equals ("equityBermudanExercise"))
                            clone = document.CreateElement ("equityBermudaExercise");
                        else if (element.LocalName.Equals ("bermudanExerciseDates"))
                            clone = document.CreateElement ("bermudaExerciseDates");
                        else if (element.LocalName.Equals ("fxSource") ||
                                 element.LocalName.Equals ("fxDetermination"))
                            clone = document.CreateElement ("fxSpotRateSource");
                        else if (element.LocalName.Equals ("futuresPriceValuationApplicable"))
                            clone = document.CreateElement ("futuresPriceValuation");
                        else if (element.LocalName.Equals ("equityValuationDate"))
                            clone = document.CreateElement ("valuationDate");
                        else if (element.LocalName.Equals ("equityValuationDates"))
                            clone = document.CreateElement ("valuationDates");
                        else if (element.LocalName.Equals ("fxTerms"))
                            clone = document.CreateElement ("fxFeature");
                        else
                            clone = document.CreateElement (element.LocalName);

                        parent.AppendChild (clone);

                        // Handle renaming for clearanceSystemIdScheme attribute
                        if (element.LocalName.Equals ("clearanceSystem")) {
                            clone.SetAttribute ("clearanceSystemScheme", element.GetAttribute ("clearanceSystemIdScheme"));
                            clone.InnerText = element.InnerText;
                            break;
                        }

                        // Handle renaming for routingIdScheme attribute
                        if (element.LocalName.Equals ("routingId")) {
                            clone.SetAttribute ("routingIdCodeScheme", element.GetAttribute ("routingIdScheme"));
                            clone.InnerText = element.InnerText;
                            break;
                        }

                        foreach (XmlAttribute attr in element.Attributes)
                            clone.SetAttribute (attr.Name, attr.Value);

                        // Handle the restructuring of equityOption
                        if (element.LocalName.Equals ("equityOption")) {
                            XmlElement target;

                            XmlElement premium	= document.CreateElement ("equityPremium");
                            XmlElement payer	= document.CreateElement ("payerPartyReference");
                            XmlElement receiver	= document.CreateElement ("receiverPartyReference");

                            if ((target = element ["buyerPartyReference"]) != null) {
                                Transcribe (target, document, clone, helper);
                                payer.SetAttribute ("href", target.GetAttribute ("href"));
                            }
                            if ((target = element ["sellerPartyReference"]) != null) {
                                Transcribe (target, document, clone, helper);
                                receiver.SetAttribute ("href", target.GetAttribute ("href"));
                            }
                            if ((target = element ["optionType"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["equityEffectiveDate"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["underlyer"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["notional"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["equityExercise"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["fxFeature"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["methodOfAdjustment"]) != null)
                                Transcribe (target, document, clone, helper);

                            if ((target = element ["extraordinaryEvents"]) != null)
                                Transcribe (target, document, clone, helper);
                            else {
                                XmlElement	child = document.CreateElement ("extraordinaryEvents");
                                XmlElement	failure = document.CreateElement ("failureToDeliver");

                                if ((target = element ["equityExercise"]["failureToDeliverApplicable"]) != null)
                                    failure.InnerText = target.InnerText;
                                else
                                    failure.InnerText = "false";

                                child.AppendChild (failure);
                                clone.AppendChild (child);
                            }

                            if ((target = element ["equityOptionFeatures"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["strike"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["spot"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["numberOfOptions"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["optionEntitlement"]) != null)
                                Transcribe (target, document, clone, helper);

                            premium.AppendChild (payer);
                            premium.AppendChild (receiver);
                            clone.AppendChild (premium);

                            break;
                        }

                        // Handle restructuring of swaption
                        if (element.LocalName.Equals ("swaption")) {
                            XmlElement target;
                            XmlElement agent = document.CreateElement ("calculationAgent");

                            if ((target = element ["buyerPartyReference"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["sellerPartyReference"]) != null)
                                Transcribe (target, document, clone, helper);

                            foreach (XmlElement child in element.GetElementsByTagName ("premium"))
                                Transcribe (child, document, clone, helper);

                            if ((target = element ["americanExercise"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["bermudaExercise"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["europeanExercise"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["exerciseProcedure"]) != null)
                                Transcribe (target, document, clone, helper);

                            clone.AppendChild (agent);

                            foreach (XmlElement child in element.GetElementsByTagName ("calculationAgentPartyReference"))
                                Transcribe (child, document, agent, helper);

                            if ((target = element ["cashSettlement"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["swaptionStraddle"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["swaptionAdjustedDates"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["swap"]) != null)
                                Transcribe (target, document, clone, helper);

                            break;
                        }

                        // Handle restructuring of fxFeature
                        if (element.LocalName.Equals ("fxFeature")) {
                            XmlElement	child;
                            XmlElement	target;
                            XmlElement	rccy	= document.CreateElement ("referenceCurrency");

                            if (helper is IHelper) {
                                rccy.InnerText = (helper as IHelper).GetReferenceCurrency (element);
                                clone.AppendChild (rccy);
                            }
                            else
                                throw new ConversionException ("Cannot determine the fxFeature reference currency");

                            if (element ["fxFeatureType"].InnerText.Trim ().ToUpper ().Equals ("COMPOSITE")) {
                                child = document.CreateElement ("composite");

                                if ((target = element ["fxSource"]) != null)
                                    Transcribe (target, document, child, helper);
                            }
                            else {
                                child = document.CreateElement ("quanto");

                                XmlElement	pair	= document.CreateElement ("quotedCurrencyPair");
                                XmlElement	ccy1	= document.CreateElement ("currency1");
                                XmlElement	ccy2	= document.CreateElement ("currency2");
                                XmlElement	basis	= document.CreateElement ("quoteBasis");
                                XmlElement	rate	= document.CreateElement ("fxRate");
                                XmlElement	value	= document.CreateElement ("rate");

                                if (helper is IHelper) {
                                    ccy1.InnerText = (helper as IHelper).GetQuantoCurrency1 (element);
                                    ccy2.InnerText = (helper as IHelper).GetQuantoCurrency2 (element);
                                    basis.InnerText = (helper as IHelper).GetQuantoBasis (element);
                                }
                                else
                                    throw new ConversionException ("Cannot determine fxFeature quanto currencies");

                                pair.AppendChild (ccy1);
                                pair.AppendChild (ccy2);
                                pair.AppendChild (basis);

                                if ((target = element ["fxRate"]) != null)
                                    value.InnerText = target.InnerText;
                                else
                                    value.InnerText = "0.0000";

                                rate.AppendChild (pair);
                                rate.AppendChild (value);

                                child.AppendChild (rate);

                                if ((target = element ["fxSource"]) != null)
                                    Transcribe (target, document, child, helper);
                            }
                            clone.AppendChild (child);

                            break;
                        }

                        // Handle restucturing of fxTerms
                        if (element.LocalName.Equals ("fxTerms")) {
                            XmlElement	kind;
                            XmlElement	child;

                            if ((kind = element ["quanto"]) != null) {
                                Transcribe (kind ["referenceCurrency"], document, clone, helper);

                                child = document.CreateElement ("quanto");

                                foreach (XmlElement target in kind.GetElementsByTagName ("fxRate"))
                                    Transcribe (target, document, child, helper);

                                clone.AppendChild (child);
                            }
                            if ((kind = element ["compositeFx"]) != null) {
                                XmlElement	target;

                                Transcribe (kind ["referenceCurrency"], document, clone, helper);

                                child = document.CreateElement ("composite");

                                if ((target = kind ["determinationMethod"]) != null)
                                    Transcribe (target, document, child, helper);
                                if ((target = kind ["relativeDate"]) != null)
                                    Transcribe (target, document, child, helper);
                                if ((target = kind ["fxDetermination"]) != null)
                                    Transcribe (target, document, child, helper);

                                clone.AppendChild (child);
                            }
                            break;
                        }

                        // Handle new buyer/seller party references in equity swap
                        if (element.LocalName.Equals ("equitySwap")) {
                            XmlElement	target;

                            if ((target = element ["productType"]) != null)
                                Transcribe (target, document, clone, helper);

                            foreach (XmlElement child in element.GetElementsByTagName ("productId"))
                                Transcribe (child, document, clone, helper);

                            XmlElement	firstLeg = element.GetElementsByTagName ("equityLeg")[0] as XmlElement;

                            XmlElement	buyer	= document.CreateElement ("buyerPartyReference");
                            XmlElement	seller	= document.CreateElement ("sellerPartyReference");

                            buyer.SetAttribute ("href", firstLeg ["payerPartyReference"].GetAttribute ("href"));
                            seller.SetAttribute ("href", firstLeg ["receiverPartyReference"].GetAttribute ("href"));

                            clone.AppendChild (buyer);
                            clone.AppendChild (seller);

                            foreach (XmlElement child in element.GetElementsByTagName ("equityLeg"))
                                Transcribe (child, document, clone, helper);
                            foreach (XmlElement child in element.GetElementsByTagName ("interestLeg"))
                                Transcribe (child, document, clone, helper);

                            if ((target = element ["principalExchangeFeatures"]) != null)
                                Transcribe (target, document, clone, helper);

                            foreach (XmlElement child in element.GetElementsByTagName ("additionalPayment"))
                                Transcribe (child, document, clone, helper);
                            foreach (XmlElement child in element.GetElementsByTagName ("earlyTermination"))
                                Transcribe (child, document, clone, helper);

                            break;
                        }

                        // Handle restructuring of initialPrice and valuationPriceFinal
                        if (element.LocalName.Equals ("initialPrice") ||
                            element.LocalName.Equals ("valuationPriceFinal")) {
                            XmlElement	target;

                            if ((target = element ["commission"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["determinationMethod"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["amountRelativeTo"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["grossPrice"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["netPrice"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["accruedInterestPrice"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["fxConversion"]) != null)
                                Transcribe (target, document, clone, helper);

                            XmlElement	valuation = document.CreateElement ("equityValuation");

                            if ((target = element ["equityValuationDate"]) != null)
                                Transcribe (target, document, valuation, helper);
                            if ((target = element ["valuationTimeType"]) != null)
                                Transcribe (target, document, valuation, helper);
                            if ((target = element ["valuationTime"]) != null)
                                Transcribe (target, document, valuation, helper);

                            clone.AppendChild (valuation);
                            break;
                        }

                        // Handle restructuring of valuationPriceInterim
                        if (element.LocalName.Equals ("valuationPriceInterim")) {
                            XmlElement	target;

                            if ((target = element ["commission"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["determinationMethod"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["amountRelativeTo"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["grossPrice"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["netPrice"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["accruedInterestPrice"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["fxConversion"]) != null)
                                Transcribe (target, document, clone, helper);

                            XmlElement	valuation = document.CreateElement ("equityValuation");

                            if ((target = element ["equityValuationDates"]) != null)
                                Transcribe (target, document, valuation, helper);
                            if ((target = element ["valuationTimeType"]) != null)
                                Transcribe (target, document, valuation, helper);
                            if ((target = element ["valuationTime"]) != null)
                                Transcribe (target, document, valuation, helper);

                            clone.AppendChild (valuation);
                            break;
                        }
                        // Handle new optionality in constituentWeight
                        if (element.LocalName.Equals ("constituentWeight")) {
                            XmlElement	target = element ["basketPercentage"];

                            if (target != null)
                                Transcribe (target, document, clone, helper);
                            else
                                Transcribe (element ["openUnits"], document, clone, helper);

                            break;
                        }

                        // Handle transfer of failure to deliver into extraordinary events
                        if (element.LocalName.Equals ("extraordinaryEvents")) {
                            XmlElement	target;

                            if ((target = element ["mergerEvents"]) != null)
                                Transcribe (target, document, clone, helper);

                            XmlElement	failure = document.CreateElement ("failureToDeliver");

                            if ((target = (element.ParentNode as XmlElement)["equityExercise"]["failureToDeliverApplicable"]) != null)
                                failure.InnerText = target.InnerText;
                            else
                                failure.InnerText = "false";

                            clone.AppendChild (failure);

                            if ((target = element ["nationalisationOrInsolvency"]) != null)
                                Transcribe (target, document, clone, helper);
                            if ((target = element ["delisting"]) != null)
                                Transcribe (target, document, clone, helper);

                            break;
                        }

                        // Recursively copy the child node across
                        foreach (XmlNode node in element.ChildNodes)
                            Transcribe (node, document, clone, helper);

                        break;
                    }

                default:
                    parent.AppendChild (document.ImportNode (context, false));
                    break;
                }
            }
Esempio n. 10
0
            /// <summary>
            /// Applies the <b>Conversion</b> to a <see cref="XmlDocument"/> instance
            /// to create a new <see cref="XmlDocument"/>.
            /// </summary>
            /// <param name="source">The <see cref="XmlDocument"/> to be converted.</param>
            /// <param name="helper">A <see cref="IHelper"/> used to guide conversion.</param>
            /// <returns>A new <see cref="XmlDocument"/> containing the transformed data.</returns>
            public override XmlDocument Convert(XmlDocument source, HandCoded.Meta.IHelper helper)
            {
                XmlDocument		target 	= TargetRelease.NewInstance ("FpML");
                XmlElement		oldRoot = source.DocumentElement;
                XmlElement		newRoot	= target.DocumentElement;

                // Transfer the attributes
                newRoot.SetAttribute ("xsi:type", oldRoot.GetAttribute ("xsi:type"));

                // Recursively copy the child node across
                foreach (XmlNode node in oldRoot.ChildNodes)
                    Transcribe (node, target, newRoot, helper);

                return (target);
            }
Esempio n. 11
0
            /// <summary>
            /// Applies the <b>Conversion</b> to a <see cref="XmlDocument"/> instance
            /// to create a new <see cref="XmlDocument"/>.
            /// </summary>
            /// <param name="source">The <see cref="XmlDocument"/> to be converted.</param>
            /// <param name="helper">A <see cref="IHelper"/> used to guide conversion.</param>
            /// <returns>A new <see cref="XmlDocument"/> containing the transformed data.</returns>
            public override XmlDocument Convert(XmlDocument source, HandCoded.Meta.IHelper helper)
            {
                XmlDocument		target 	= TargetRelease.NewInstance ("FpML");
                XmlElement		oldRoot = source.DocumentElement;
                XmlElement		newRoot	= target.DocumentElement;
                Dictionary<string, XmlElement>	cache = new Dictionary<string, XmlElement> ();

                newRoot.SetAttribute ("xsi:type", "DataDocument");

                // Recursively copy the child node across
                foreach (XmlNode node in oldRoot.ChildNodes)
                    Transcribe (node, target, newRoot, cache, true);

                cache.Clear ();
                return (target);
            }
Esempio n. 12
0
            /// <summary>
            /// Applies the <b>Conversion</b> to a <see cref="XmlDocument"/> instance
            /// to create a new <see cref="XmlDocument"/>.
            /// </summary>
            /// <param name="source">The <see cref="XmlDocument"/> to be converted.</param>
            /// <param name="helper">A <see cref="IHelper"/> used to guide conversion.</param>
            /// <returns>A new <see cref="XmlDocument"/> containing the transformed data.</returns>
            public override XmlDocument Convert(XmlDocument source, HandCoded.Meta.IHelper helper)
            {
                XmlElement oldRoot = source.DocumentElement;
                XmlDocument target = TargetRelease.NewInstance (oldRoot.LocalName);
                XmlElement newRoot = target.DocumentElement;

                // Recursively copy the child node across
                foreach (XmlNode node in oldRoot.ChildNodes)
                    Transcribe (node, target, newRoot);

                return (target);
            }
Esempio n. 13
0
 /// <summary>
 /// Determines if two <see cref="HandCoded.Finance.DateTime"/> values are different.
 /// </summary>
 /// <param name="lhs">The <see cref="HandCoded.Finance.DateTime"/> to compare.</param>
 /// <param name="rhs">The <see cref="HandCoded.Finance.DateTime"/> to compare to.</param>
 /// <returns><c>true</c> if the two <see cref="DateTime"/> values are different.</returns>
 public static bool NotEqual(HandCoded.Finance.DateTime lhs, HandCoded.Finance.DateTime rhs)
 {
     return (!lhs.Equals (rhs));
 }
Esempio n. 14
0
 /// <summary>
 /// Compares two <see cref="HandCoded.Finance.DateTime"/> instances to determine if the
 /// first is equal to or smaller than the second.
 /// </summary>
 /// <param name="lhs">The first DateTime.</param>
 /// <param name="rhs">The second DateTime.</param>
 /// <returns><c>true</c> if the first value is less than the second.</returns>
 public static bool LessOrEqual(HandCoded.Finance.DateTime lhs, HandCoded.Finance.DateTime rhs)
 {
     return (lhs.CompareTo (rhs) <= 0);
 }
Esempio n. 15
0
 /// <summary>
 /// Determines if the value of a <see cref="HandCoded.Finance.DateTime"/> is greater than
 /// the value of another.
 /// </summary>
 /// <param name="lhs">The <see cref="HandCoded.Finance.DateTime"/> to compare.</param>
 /// <param name="rhs">The <see cref="HandCoded.Finance.DateTime"/> to compare with.</param>
 /// <returns><c>true</c> if the first value is greater than the second.</returns>
 public static bool Greater(HandCoded.Finance.DateTime lhs, HandCoded.Finance.DateTime rhs)
 {
     return (lhs.CompareTo (rhs) > 0);
 }