Exemple #1
0
        private LocalizedName ImportLocalizedName(Culture culture, XmlNamespaceManager namespaceManager, XmlNode nameNode)
        {
            string       metadataID       = nameNode.Attributes["ref"].Value;
            XmlAttribute commentAttribute = nameNode.Attributes["comment"];

            MetadataObject metadataObject = MetadataObject.Find(metadataID);

            if (metadataObject == null)
            {
                string objectDetails = commentAttribute == null ? string.Empty : "('" + commentAttribute.Value + "') ";
                throw new ImportException(string.Format("The metadata object with the ID '{0}' {1}could not be found.", metadataID, objectDetails));
            }

            string text = nameNode.InnerText.Trim();

            LocalizedName localizedName = metadataObject.GetLocalizedName(culture);

            if (localizedName != null)
            {
                localizedName.Text = text;
                return(localizedName);
            }

            return(LocalizedName.NewObject(text, culture, metadataObject));
        }
Exemple #2
0
        private void ImportLocalizedNames(Culture culture, XmlNode parentNode, XmlNamespaceManager namespaceManager)
        {
            XmlNodeList nameNodes = parentNode.SelectNodes("/mdl:localizedNames/mdl:localizedName", namespaceManager);

            foreach (XmlNode nameNode in nameNodes)
            {
                LocalizedName localizedName = ImportLocalizedName(culture, namespaceManager, nameNode);
                _localizedNames.Add(localizedName);
            }
        }