コード例 #1
0
 public string GetEnglishValueFromFreeText(CharacterString_PropertyType input)
 {
     string value = null;
     if (input != null)
     {
         PT_FreeText_PropertyType freeText = input as PT_FreeText_PropertyType;
         if (freeText != null && freeText.PT_FreeText != null && freeText.PT_FreeText.textGroup != null)
         {
             foreach (var localizedStringProperty in freeText.PT_FreeText.textGroup)
             {
                 if (localizedStringProperty.LocalisedCharacterString != null
                     && localizedStringProperty.LocalisedCharacterString.locale != null
                     && localizedStringProperty.LocalisedCharacterString.locale.ToUpper().Equals("#ENG"))
                 {
                     value = localizedStringProperty.LocalisedCharacterString.Value;
                     break;
                 }
             }
         }
     }
     return value;
 }
コード例 #2
0
        public void ReadXml(System.Xml.XmlReader reader)
        {

            var data = reader.ReadOuterXml();

            if (data.Contains("PT_FreeText"))
            {
                XmlDocument doc = new XmlDocument();
                var nsmgr = new XmlNamespaceManager(doc.NameTable);
                nsmgr.AddNamespace("gmd", "http://www.isotc211.org/2005/gmd");
                nsmgr.AddNamespace("gco", "http://www.isotc211.org/2005/gco");
                doc.LoadXml(data);
                string otherConstraints = "";
                string otherConstraintsEnglish = "";
                var otherConstraintsNode = doc.SelectSingleNode("//gmd:otherConstraints/gco:CharacterString", nsmgr);
                if (otherConstraintsNode != null)
                    otherConstraints = otherConstraintsNode.InnerText;
                var otherConstraintsEnglishNode = doc.SelectSingleNode("//gmd:otherConstraints/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString[@locale='#ENG']", nsmgr);
                if (otherConstraintsEnglishNode != null)
                    otherConstraintsEnglish = otherConstraintsEnglishNode.InnerText;
                MD_RestrictionOther = CreateFreeTextElement(otherConstraints, otherConstraintsEnglish);

            }
            else if (data.Contains("gmx:Anchor"))
            {
                XmlDocument doc = new XmlDocument();
                var nsmgr = new XmlNamespaceManager(doc.NameTable);
                nsmgr.AddNamespace("gmd", "http://www.isotc211.org/2005/gmd");
                nsmgr.AddNamespace("gmx", "http://www.isotc211.org/2005/gmx");
                nsmgr.AddNamespace("xlink", "http://www.w3.org/1999/xlink");
                doc.LoadXml(data);
                string otherConstraints = "";
                string otherConstraintsLink = "";
                var otherConstraintsNode = doc.SelectSingleNode("//gmd:otherConstraints/gmx:Anchor", nsmgr);
                if (otherConstraintsNode != null)
                    otherConstraints = otherConstraintsNode.InnerText;
                var otherConstraintsLinkNode = doc.SelectSingleNode("//gmd:otherConstraints/gmx:Anchor/@xlink:href", nsmgr);
                if (otherConstraintsLinkNode != null)
                    otherConstraintsLink = otherConstraintsLinkNode.InnerText;

                MD_RestrictionOther = new Anchor_Type { Value = otherConstraints, href = otherConstraintsLink };
            }
            else if (data.Contains("gco:CharacterString"))
            {
                XmlDocument doc = new XmlDocument();
                var nsmgr = new XmlNamespaceManager(doc.NameTable);
                nsmgr.AddNamespace("gmd", "http://www.isotc211.org/2005/gmd");
                nsmgr.AddNamespace("gco", "http://www.isotc211.org/2005/gco");
                doc.LoadXml(data);
                string otherConstraints = "";
                var otherConstraintsNode = doc.SelectSingleNode("//gmd:otherConstraints/gco:CharacterString", nsmgr);
                if (otherConstraintsNode != null)
                    otherConstraints = otherConstraintsNode.InnerText;

                MD_RestrictionOther = new CharacterString_PropertyType { CharacterString = otherConstraints };
            }

        }
コード例 #3
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            var data = reader.ReadOuterXml();

            XmlDocument doc = new XmlDocument();
            var ns = new XmlNamespaceManager(doc.NameTable);
            ns.AddNamespace("gmd", "http://www.isotc211.org/2005/gmd");
            ns.AddNamespace("gmx", "http://www.isotc211.org/2005/gmx");
            ns.AddNamespace("xlink", "http://www.w3.org/1999/xlink");
            ns.AddNamespace("gco", "http://www.isotc211.org/2005/gco");
            doc.LoadXml(data);

                var anchor = doc.SelectSingleNode("//gmd:keyword/gmx:Anchor", ns);

                XmlElement node = doc.DocumentElement as XmlElement;

                if ((node != null) && node.HasAttribute("xsi:type") 
                    && node.Attributes["xsi:type"].Value == "gmd:PT_FreeText_PropertyType")
                {
                    string keywordString = "";
                    string keywordEnglish = "";
                    var keywordNode = doc.SelectSingleNode("//gmd:keyword/gco:CharacterString", ns);
                    if (keywordNode != null)
                        keywordString = keywordNode.InnerText;
                    var keywordEnglishNode = doc.SelectSingleNode("//gmd:keyword/gmd:PT_FreeText/gmd:textGroup/gmd:LocalisedCharacterString[@locale='#ENG']", ns);
                    if (keywordEnglishNode != null)
                        keywordEnglish = keywordEnglishNode.InnerText;

                    keyword = CreateFreeTextElement(keywordString, keywordEnglish);
                }

                else if (anchor != null)
                {
                    string keyWordString = anchor.InnerText;
                    string keyWordLink = "";
                    var keyWordsLinkNode = anchor.SelectSingleNode("//gmd:keyword/gmx:Anchor/@xlink:href", ns);
                    if (keyWordsLinkNode != null)
                        keyWordLink = keyWordsLinkNode.InnerText;

                    keyword = new Anchor_Type { Value = keyWordString, href = keyWordLink };
                }
                else
                {
                    string keyWordString = "";
                    var keyWordNode = doc.SelectSingleNode("//gmd:keyword/gco:CharacterString", ns);
                    if (keyWordNode != null)
                        keyWordString = keyWordNode.InnerText;

                    keyword = new CharacterString_PropertyType { CharacterString = keyWordString };
                }
        }
コード例 #4
0
 private static CharacterString_PropertyType CharString(string s)
 {
     var sp = new CharacterString_PropertyType();
     sp.CharacterString = s;
     return sp;
 }
コード例 #5
0
        private void SetTitleElement(CharacterString_PropertyType element)
        {
            var identification = GetIdentificationNotNull();

            if (identification.citation == null)
            {
                identification.citation = new CI_Citation_PropertyType();
            }

            if (identification.citation.CI_Citation == null)
            {
                identification.citation.CI_Citation = new CI_Citation_Type();
            }

            identification.citation.CI_Citation.title = element;
        }
コード例 #6
0
 private string GetStringOrNull(CharacterString_PropertyType input)
 {
     return input != null ? input.CharacterString : null;
 }