/// <summary>
        /// Instantiates a <see cref="CsvQueryColumnConfiguration"/>
        /// </summary>
        /// <param name="xmlElement"></param>
        public CsvQueryColumnConfiguration(XmlElement xmlElement)
        {
            // validate element
            xmlElement.ShouldBeNamed(ColumnElementName);

            // get attribute values
            _tag = xmlElement.GetAttributeValue(TagAttributeName);
            _description = xmlElement.GetAttributeValue(DescriptionAttributeName);
            _mappedProperty = xmlElement.GetAttributeValue(MappedPropertyAttributeName, false);
            _enabled = bool.Parse(xmlElement.GetAttributeValue(EnabledAttributeName));
        }
示例#2
0
// パブリックメソッド

		public void LoadXml(XmlElement e){
			Name = e.GetAttributeValue(ExtInfoName);
			ContentType = e.GetAttributeValue(ExtInfoType);
			Charset = e.GetAttributeValue(ExtInfoCharset);
			Description = e.InnerText;

			string tempDisposition = e.GetAttributeValue(ExtInfoDisposition);
			if(!string.IsNullOrEmpty(tempDisposition)) Disposition = true;

			int maxAgeDays = e.GetAttributeInt(ExtInfoMaxAge);
			MaxAge = new TimeSpan(maxAgeDays, 0, 0, 0);
		}
        /// <summary>
        /// Instantiates a <see cref="YqlPropertyMappingElement"/>
        /// </summary>
        /// <param name="xmlElement"></param>
        public YqlPropertyMappingElement(XmlElement xmlElement)
        {
            // validate element
            xmlElement.ShouldBeNamed(PropertyMappingElementName);

            // get attribute values
            _xmlElementName = xmlElement.GetAttributeValue(XmlElementNameAttributeName);
            _propertyName = xmlElement.GetAttributeValue(PropertyNameAttributeName);

            // set enabled, with a default value of false
            bool enabled;
            if (bool.TryParse(xmlElement.GetAttributeValue(EnabledAttributeName, false), out enabled))
                _enabled = enabled;
        }
示例#4
0
// コンストラクタ
		/// <summary>
		/// XmlNode を指定して、HtmlElement クラスのインスタンスを開始します。
		/// </summary>
		public HtmlAttribute(XmlElement e) : base(e){
			myNote = e.GetInnerText(HatomaruHtmlRef.NoteElementName);
			myDefault = e.GetInnerText(HatomaruHtmlRef.DefaultElementName);
			myFor = e.GetAttributeValue(HatomaruHtmlRef.ForAttributeName);
			if(string.IsNullOrEmpty(myId)){
				myId = myName;
				if(!string.IsNullOrEmpty(myFor)) myId += IdSeparator + myFor;
			}
		}
        public bool Map(object destinationObject, PropertyInfo destinationProperty, XmlElement element, XmlElement allConfig, ConfigMapper mapper)
        {
            var attributeValue = element.GetAttributeValue(AttributeName ??  destinationProperty.Name);

            if (attributeValue == null)
            {
                return false;
            }

            var destinationPropertyType = destinationProperty.PropertyType;

            if (destinationPropertyType.IsEnum)
            {
                var value = Enum.Parse(destinationPropertyType, attributeValue);
                destinationProperty.SetValue(destinationObject, value, null);
                return true;
            }

            if (destinationPropertyType.IsNullable())
            {
                if (attributeValue == "")
                {
                    destinationProperty.SetValue(destinationObject, null, null);
                    return true;
                }
                
                destinationPropertyType = destinationPropertyType.GetGenericArguments()[0];
            }

            if (destinationPropertyType.IsA<IConvertible>())
            {
                var value = Convert.ChangeType(attributeValue, destinationPropertyType);
                destinationProperty.SetValue(destinationObject, value, null);
                return true;
            }

            return false;
        }
 /// <summary>
 /// Gets a lifetime manager from an attribute of an element
 /// </summary>
 /// <param name="element"></param>
 /// <param name="attributeName"></param>
 /// <returns></returns>
 private static LifetimeManager GetLifetimeManager(XmlElement element, string attributeName)
 {
     return GetLifetimeManager(element.GetAttributeValue(attributeName));
 }
示例#7
0
        /// <exception cref="InvalidException">
        /// The save format is corrupt and could not be loaded.
        /// </exception>
        public override void Deserialize(DeserializeContext context, XmlElement root)
        {
            try
            {
                Language language = Language.GetLanguage(root.GetAttributeValue("Language", "UML"));
                if (language == null)
                    throw new InvalidDataException("Invalid project language.");

                this.language = language;
            }
            catch (Exception ex)
            {
                throw new InvalidException("Invalid project language.", ex);
            }
            base.Deserialize(context, root);
        }
        /// <summary>
        /// Gets a registration from an xml element
        /// </summary>
        /// <param name="registrationElement"></param>
        /// <returns></returns>
        private static Registration CreateRegistration(XmlElement registrationElement)
        {
            registrationElement.ShouldBeNamed(RegistrationElementName);

            // initialize injection constructor to null
            InjectionConstructor injectionConstructor = null;

            // check for an injection constructor element
            var injectionConstructorElement =
                registrationElement.ChildNodes.OfType<XmlElement>()
                                   .FirstOrDefault(x => x.Name == InjectionConstructorElementName);
            if (injectionConstructorElement != null)
                injectionConstructor = GetInjectionConstructor(injectionConstructorElement);

            return new Registration(registrationElement.GetTypeFromAttribute(RegistrationTypeAttributeName),
                registrationElement.GetTypeFromAttribute(RegistrationMapToAttributeName),
                GetLifetimeManager(registrationElement, RegistrationLifetimeAttributeName),
                registrationElement.GetAttributeValue(RegistrationNameAttributeName, false),
                injectionConstructor);
        }
示例#9
0
 void LoadSchemaInfo(XmlElement child, Field field)
 {
     field.GenerateDbColumn = child.GetAttributeValue("GenColumn", false);
     if (field.GenerateDbColumn)
     {
         field.DbSchema.Initialing = true;
         field.DbSchema.Name = child.GetAttributeValue("Name", "");
         field.DbSchema.NotNull = child.GetAttributeValue("NotNull", false);
         field.DbSchema.AutoIncrement = child.GetAttributeValue("AutoIncrement", false);
         field.DbSchema.DbType = child.GetAttributeValue<System.Data.DbType?>("DbType", null);
         field.DbSchema.DefaultValue = child.GetAttributeValue("DefaultValue", "");
         field.DbSchema.Index = child.GetAttributeValue("Index", false);
         field.DbSchema.IsPrimaryKey = child.GetAttributeValue("IsPrimaryKey", false);
         field.DbSchema.Length = child.GetAttributeValue("Length", "");
         field.DbSchema.Initialing = false;
     }
 }
示例#10
0
 internal DateTimeFormat(DateTimeFormatTypes dateTimeFormatTypes, XmlElement xmlElement)
 {
     Name = xmlElement.GetAttributeValue("name");
     TypeId = int.Parse(xmlElement.GetAttributeValue("type"));
     Example = xmlElement.GetAttributeValue("example");
     _formatTypes = dateTimeFormatTypes;
 }
示例#11
0
 internal RunningSessionInfo(XmlElement element)
 {
     _projectName = element.GetAttributeValue("projectname");
     _moduleName = element.GetAttributeValue("moduledescription");
     _loginDate = element.GetOADate("logindate").GetValueOrDefault();
     _lastActionDate = element.GetOADate("lastactiondate").GetValueOrDefault();
     element.TryGetGuid(out _loginGuid);
 }
示例#12
0
 protected Locale(ISession session, XmlElement xmlElement)
 {
     _session = session;
     LanguageAbbreviation = xmlElement.GetAttributeValue("id");
     Country = xmlElement.GetAttributeValue("country");
     Language = xmlElement.GetAttributeValue("language");
     IsStandardLanguage = xmlElement.GetBoolAttributeValue("standardlanguage").GetValueOrDefault();
     LCID = xmlElement.GetIntAttributeValue("lcid").GetValueOrDefault();
     RFCLanguageId = xmlElement.GetAttributeValue("rfclanguageid");
     DateTimeFormats = new IndexedCachedList<int, IDateTimeFormat>(GetFormats, x => x.TypeId, Caching.Enabled);
 }
示例#13
0
 internal InfoAttribute(XmlElement xmlElement)
 {
     Type = (InfoType) Enum.Parse(typeof (InfoType), xmlElement.Name, true);
     Id = int.Parse(xmlElement.GetAttributeValue("id"));
     Name = xmlElement.GetAttributeValue("name");
 }
        /// <summary>
        /// Gets a parameter for a constructor from a parameter XmlElement
        /// </summary>
        /// <param name="parameterElement"></param>
        /// <returns></returns>
        private static object GetConstructorParameter(XmlElement parameterElement)
        {
            // ensure element is parameter element
            parameterElement.ShouldBeNamed(ParameterElementName);

            // get flag indicating whether or not to resolve the value of the parameter
            var resolve = parameterElement.GetAttributeValue(ResolveAttributeName).ConvertTo<bool>();

            // get the type of the parameter
            var type = parameterElement.GetTypeFromAttribute(TypeAttributeName);

            // get value to be passed in - if resolving, this is not required
            var value = parameterElement.GetAttributeValue(ValueAttributeName, !resolve);

            // get value for parameter
            return resolve
                ? new ResolvedParameter(type, string.IsNullOrWhiteSpace(value) ? value : null)
                : value.ConvertTo(type);
        }
示例#15
0
		public HtmlItem(XmlElement e){
			myXmlElement = e;
			myId = e.GetAttributeValue(HatomaruHtmlRef.IdAttributeName);
			myName = e.GetAttributeValue(HatomaruHtmlRef.NameAttributeName);
			myDescription = e[HatomaruHtmlRef.DescElementName];
		}
示例#16
0
		// navitem要素をパースします。
		private XmlNode ParseNavItem(XmlElement myNode, int headingLevel){
			XmlElement result = Html.Create("li");
			XmlElement a = Html.GetA(myNode);
			result.AppendChild(a);
			string itemPath = myNode.GetAttributeValue("href");
			if(myPath.ToString().StartsWith(itemPath)){
				result.SetAttribute("class", "stay");
				myChildrenNavPoint = result;
			}
			return result;
		}
示例#17
0
文件: IFile.cs 项目: erminas/smartapi
 internal File(IProject project, XmlElement xmlElement)
 {
     _project = project;
     _xmlElement = xmlElement;
     _name = xmlElement.GetAttributeValue("name");
     var folderGuid = xmlElement.GetGuid("folderguid");
     _folder = project.Folders.AllIncludingSubFolders.GetByGuid(folderGuid);
     Guid guid;
     if (_xmlElement.TryGetGuid("thumbguid", out guid))
     {
         _thumbnailGuid = guid;
     }
     if (IsAssetWithThumbnail)
     {
         //older versions do not contain the thumbnailpath attribute, so it has to be constructed
         ThumbnailPath = xmlElement.GetAttributeValue("thumbnailpath") ?? CreateThumbnailPath();
     }
 }
示例#18
0
        /*
        private static readonly Dictionary<string, string> RQLMapping = new Dictionary<string, string>()
                                                           {
                                                               {"ext01", "Erstellungsautor"},
                                                               {"ext02", "Datum der Erstaufnahme"},
                                                               {"ext03", "Änderungsautor"},
                                                               {"ext04", "Änderungsdatum"},
                                                               {"ext05", "Höhe (Pixel)"},
                                                               {"ext06", "Breite (Pixel)"},
                                                               {"ext07", "Farbtiefe (Bit)"},
                                                               {"ext08", "Dateigröße (Byte)"},
                                                               {"ext09", "Titel"},
                                                               {"ext10", "Künstler"},
                                                               {"ext11", "Album"},
                                                               {"ext12", "Jahr"},
                                                               {"ext13", "Kommentar"},
                                                               {"ext14", "Genre"}
                                                           };*/
        private void LoadXml(XmlElement xmlElement)
        {
            if (xmlElement == null)
            {
                return;
            }
            try
            {
                if (xmlElement.GetAttributeValue("ext01") != null)
                {
                    OriginalAuthor = xmlElement.GetAttributeValue("ext01");
                }

                if (xmlElement.GetAttributeValue("ext02") != null)
                {
                    EntryDate = xmlElement.GetOADate("ext02").GetValueOrDefault();
                }

                if (xmlElement.GetAttributeValue("ext03") != null)
                {
                    LastEditor = xmlElement.GetAttributeValue("ext03");
                }

                if (xmlElement.GetAttributeValue("ext04") != null)
                {
                    ModificationDate = xmlElement.GetOADate("ext04").GetValueOrDefault();
                }

                if (xmlElement.GetAttributeValue("ext05") != null)
                {
                    Height = xmlElement.GetAttributeValue("ext05") + " Pixel";
                }

                if (xmlElement.GetAttributeValue("ext06") != null)
                {
                    Width = xmlElement.GetAttributeValue("ext06") + " Pixel";
                }

                if (xmlElement.GetAttributeValue("ext07") != null)
                {
                    Colordepth = xmlElement.GetAttributeValue("ext07") + " Bit";
                }

                if (xmlElement.GetAttributeValue("ext08") != null)
                {
                    Filesize = xmlElement.GetAttributeValue("ext08") + " Byte";
                }

                if (xmlElement.GetAttributeValue("ext09") != null)
                {
                    Title = xmlElement.GetAttributeValue("ext09");
                }

                if (xmlElement.GetAttributeValue("ext10") != null)
                {
                    Artist = xmlElement.GetAttributeValue("ext10");
                }

                if (xmlElement.GetAttributeValue("ext11") != null)
                {
                    Album = xmlElement.GetAttributeValue("ext11");
                }

                if (xmlElement.GetAttributeValue("ext12") != null)
                {
                    Year = xmlElement.GetAttributeValue("ext12");
                }

                if (xmlElement.GetAttributeValue("ext13") != null)
                {
                    Comment = xmlElement.GetAttributeValue("ext13");
                }

                if (xmlElement.GetAttributeValue("ext14") != null)
                {
                    Genre = xmlElement.GetAttributeValue("ext14");
                }

                if (xmlElement.GetAttributeValue("ext4124") != null)
                {
                    DocTitle = xmlElement.GetAttributeValue("ext4124");
                }

                if (xmlElement.GetAttributeValue("ext4125") != null)
                {
                    Keywords = xmlElement.GetAttributeValue("ext4125");
                }

                if (xmlElement.GetAttributeValue("ext4126") != null)
                {
                    DocAuthor = xmlElement.GetAttributeValue("ext4126");
                }

                if (xmlElement.GetAttributeValue("ext4127") != null)
                {
                    DocOriginalAuthor = xmlElement.GetAttributeValue("ext4127");
                }

                if (xmlElement.GetAttributeValue("ext4128") != null)
                {
                    DocCreatedWith = xmlElement.GetAttributeValue("ext4128");
                }

                if (xmlElement.GetAttributeValue("ext4129") != null)
                {
                    DocCreationDate = xmlElement.GetAttributeValue("ext4129");
                }

                if (xmlElement.GetAttributeValue("ext4130") != null)
                {
                    DocModificationDate = xmlElement.GetAttributeValue("ext4130");
                }

                if (xmlElement.GetAttributeValue("ext4131") != null)
                {
                    DocNumberOfPages = int.Parse(xmlElement.GetAttributeValue("ext4131"));
                }
            } catch (Exception e)
            {
                // couldn't read data
                throw new FileDataException(Folder.Project.Session.ServerLogin, "Couldn't read file data..", e);
            }
        }
示例#19
0
 /// <summary>
 ///     Create an element out of its XML representation (uses the attribute "elttype") to determine the element type and create the appropriate object.
 /// </summary>
 /// <param name="contentClass"> parent content class that contains the element </param>
 /// <param name="xmlElement"> XML representation of the element </param>
 /// <exception cref="ArgumentException">if the "elttype" attribute of the XML node contains an unknown value</exception>
 internal static ContentClassElement CreateElement(IContentClass contentClass, XmlElement xmlElement)
 {
     var type = (ElementType) int.Parse(xmlElement.GetAttributeValue("elttype"));
     switch (type)
     {
         case ElementType.DatabaseContent:
             return new DatabaseContent(contentClass, xmlElement);
         case ElementType.TextHtml:
             return new TextHtml(contentClass, xmlElement);
         case ElementType.TextAscii:
             return new TextAscii(contentClass, xmlElement);
         case ElementType.StandardFieldText:
         case ElementType.StandardFieldTextLegacy:
             return new StandardFieldText(contentClass, xmlElement);
         case ElementType.StandardFieldNumeric:
             return new StandardFieldNumeric(contentClass, xmlElement);
         case ElementType.StandardFieldDate:
             return new StandardFieldDate(contentClass, xmlElement);
         case ElementType.StandardFieldTime:
             return new StandardFieldTime(contentClass, xmlElement);
         case ElementType.StandardFieldUserDefined:
             return new StandardFieldUserDefined(contentClass, xmlElement);
         case ElementType.StandardFieldEmail:
             return new StandardFieldEmail(contentClass, xmlElement);
         case ElementType.StandardFieldUrl:
             return new StandardFieldURL(contentClass, xmlElement);
         case ElementType.Headline:
             return new Headline(contentClass, xmlElement);
         case ElementType.Background:
             return new Background(contentClass, xmlElement);
         case ElementType.Image:
             return new Image(contentClass, xmlElement);
         case ElementType.Media:
             return new Media(contentClass, xmlElement);
         case ElementType.ListEntry:
             return new ListEntry(contentClass, xmlElement);
         case ElementType.Transfer:
             return new Transfer(contentClass, xmlElement);
         case ElementType.Ivw:
             return new IVW(contentClass, xmlElement);
         case ElementType.OptionList:
             return new OptionList(contentClass, xmlElement);
         case ElementType.Attribute:
             return new Attribute(contentClass, xmlElement);
         case ElementType.Info:
             return new Info(contentClass, xmlElement);
         case ElementType.Browse:
             return new Browse(contentClass, xmlElement);
         case ElementType.Area:
             return new Area(contentClass, xmlElement);
         case ElementType.AnchorAsImage:
             return new ImageAnchor(contentClass, xmlElement);
         case ElementType.AnchorAsText:
             return new TextAnchor(contentClass, xmlElement);
         case ElementType.Container:
             return new Container(contentClass, xmlElement);
         case ElementType.Frame:
             return new Frame(contentClass, xmlElement);
         case ElementType.SiteMap:
             return new SiteMap(contentClass, xmlElement);
         case ElementType.HitList:
             return new HitList(contentClass, xmlElement);
         case ElementType.List:
             return new List(contentClass, xmlElement);
         case ElementType.ProjectContent:
             return new ProjectContent(contentClass, xmlElement);
         case ElementType.ConditionRedDotLiveOrDeliveryServer:
             return new DeliveryServerConstraint(contentClass, xmlElement);
         default:
             throw new ArgumentException("unknown element type: " + type);
     }
 }
示例#20
0
 private void LoadXml(XmlElement xmlElement)
 {
     Type = xmlElement.GetAttributeValue("id").ToModuleType();
 }
示例#21
0
 /// <summary>
 ///     Create an element out of its XML representation (uses the attribute "elttype") to determine the element type and create the appropriate object.
 /// </summary>
 /// <param name="project"> Page that contains the element </param>
 /// <param name="xmlElement"> XML representation of the element </param>
 /// <exception cref="ArgumentException">if the "elttype" attribute of the XML node contains an unknown value</exception>
 public static IPageElement CreateElement(IProject project, XmlElement xmlElement)
 {
     var typeValue = (ElementType) int.Parse(xmlElement.GetAttributeValue("elttype"));
     Type type;
     if (!TYPES.TryGetValue(typeValue, out type))
     {
         throw new ArgumentException(string.Format("Unknown element type: {0}", typeValue));
     }
     return
         (IPageElement)
         Activator.CreateInstance(type, BindingFlags.NonPublic | BindingFlags.Instance, null,
                                  new object[] {project, xmlElement}, CultureInfo.InvariantCulture);
 }
示例#22
0
 private static string CheckAlreadyLoggedIn(XmlElement xmlElement)
 {
     return xmlElement.GetAttributeValue("loginguid") ?? "";
 }
示例#23
0
/* ======== コンストラクタ ======== */

		/// <summary>
		/// XmlElement を指定して、GlossaryDesc クラスのインスタンスを開始します。
		/// </summary>
		public GlossaryDesc(XmlElement e){
			myDescription = e;
			string genres = e.GetAttributeValue(HatomaruGlossary.GenreAttributeName);
			if(string.IsNullOrEmpty(genres)) return;
			myGenre = genres.Split(new[]{','}, StringSplitOptions.RemoveEmptyEntries);
		}