/// <summary>
        /// Gets the id element.
        /// </summary>
        /// <param name="document">The doc.</param>
        /// <param name="idValue">The id.</param>
        /// <returns></returns>
        public override XmlElement GetIdElement(XmlDocument document, string idValue)
        {
            if (String.IsNullOrEmpty(idValue))
            {
                return(null);
            }

            var xmlElement = base.GetIdElement(document, idValue);
            var nsmgr      = XsdSchemas.CreateXadesNamespaceManager(document);

            if (xmlElement != null)
            {
                return(XsdSchemas.FixupNamespaces(document, xmlElement));
            }

            if (dataObjects.Count > 0)
            {
                if (this.dataObjects != null && this.dataObjects.Count > 0)
                {
                    foreach (DataObject dataObject in this.dataObjects)
                    {
                        var nodeWithSameId = dataObject.GetXml().SelectNodes(".", nsmgr).FindNode("Id", idValue);

                        if (nodeWithSameId != null)
                        {
                            return(XsdSchemas.FixupNamespaces(document, nodeWithSameId));
                        }
                    }
                }
            }

            // Search the KeyInfo Node
            if (this.KeyInfo != null)
            {
                var nodeWithSameId = this.KeyInfo.GetXml().SelectNodes(".", nsmgr).FindNode("Id", idValue);

                if (nodeWithSameId != null)
                {
                    return(XsdSchemas.FixupNamespaces(document, nodeWithSameId));
                }
            }

            return(null);
        }
Beispiel #2
0
        public static string ToXml(this QualifyingPropertiesType qualifyingProperties)
        {
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Encoding = new UTF8Encoding(false);

            using (MemoryStream buffer = new MemoryStream())
            {
                using (XmlWriter writer = XmlWriter.Create(buffer, settings))
                {
                    QualifyingPropertiesSerializer.Serialize(writer, qualifyingProperties, XsdSchemas.CreateXadesSerializerNamespace());
                }

                return(Encoding.UTF8.GetString(buffer.ToArray()));
            }
        }
Beispiel #3
0
 internal XsdParameters Merge(XsdParameters parameters)
 {
     if (parameters.classes)
     {
         classes = parameters.classes;
     }
     if (parameters.dataset)
     {
         dataset = parameters.dataset;
     }
     if (parameters.language != null)
     {
         language = parameters.language;
     }
     if (parameters.ns != null)
     {
         ns = parameters.ns;
     }
     if (parameters.nologo)
     {
         nologo = parameters.nologo;
     }
     if (parameters.outputdir != null)
     {
         outputdir = parameters.outputdir;
     }
     if (!parameters.optionsDefault)
     {
         options = parameters.options;
     }
     if (parameters.uri != null)
     {
         uri = parameters.uri;
     }
     foreach (string current in parameters.XsdSchemas)
     {
         XsdSchemas.Add(current);
     }
     foreach (string current2 in parameters.XdrSchemas)
     {
         XdrSchemas.Add(current2);
     }
     foreach (string current3 in parameters.Instances)
     {
         Instances.Add(current3);
     }
     foreach (string current4 in parameters.Assemblies)
     {
         Assemblies.Add(current4);
     }
     foreach (string current5 in parameters.Elements)
     {
         Elements.Add(current5);
     }
     foreach (string current6 in parameters.Types)
     {
         Types.Add(current6);
     }
     foreach (string current7 in parameters.SchemaImporterExtensions)
     {
         SchemaImporterExtensions.Add(current7);
     }
     return(this);
 }