当前位置: 首页>>代码示例>>C#>>正文


C# XElement.AttributeValue方法代码示例

本文整理汇总了C#中System.Xml.Linq.XElement.AttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C# XElement.AttributeValue方法的具体用法?C# XElement.AttributeValue怎么用?C# XElement.AttributeValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.Linq.XElement的用法示例。


在下文中一共展示了XElement.AttributeValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: From

 public static TinyMceFontConfig From(XElement xml)
 {
     return new TinyMceFontConfig(
         xml.AttributeValue("culture"),
         xml.AttributeValue("fonts")
     );
 }
开发者ID:sigcms,项目名称:Seeger,代码行数:7,代码来源:TinyMceFontConfig.cs

示例2: GetAttributeValueTest0

        public void GetAttributeValueTest0()
        {
            var e1 = new XElement("Foo");
            Assert.AreEqual("beer", e1.AttributeValue("a1", "beer"));

            e1.SetAttributeValue("a1", "baz");
            Assert.AreEqual("baz", e1.AttributeValue("a1", "beer"));
        }
开发者ID:saveenr,项目名称:saveenr,代码行数:8,代码来源:XElementExtensionsTest.cs

示例3: DomElement

 public DomElement(XElement el) {
   name = el.Name.LocalName;
   cls = el.AttributeValue("class");
   id = el.AttributeValue("id");
   if (name != typeof(body).Name) parent = new DomElement(el.Parent);
   uniqueId = cnt++.ToString();
   this.el = el;
 }
开发者ID:PavelPZ,项目名称:REW,代码行数:8,代码来源:SchemaCSS.cs

示例4: GetAttributeValueTest1

        public void GetAttributeValueTest1()
        {
            var e1 = new XElement("Foo");
            Assert.AreEqual(2, e1.AttributeValue<int>("a1", 2, s => int.Parse(s)));

            e1.SetAttributeValue("a1", "4");
            Assert.AreEqual(4, e1.AttributeValue<int>("a1", 2, s => int.Parse(s)));
            Assert.AreEqual(4.0, e1.AttributeValue<double>("a1", 2, s => double.Parse(s)));
        }
开发者ID:saveenr,项目名称:saveenr,代码行数:9,代码来源:XElementExtensionsTest.cs

示例5: FromXml

 internal static EntitySet FromXml(XElement xml)
 {
     if (xml.Name.LocalName != ElementName) throw new ArgumentException("xml was not an EntitySet element");
     var obj = new EntitySet
     {
         Name = xml.AttributeValue("Name"),
         EntityType = xml.AttributeValue("EntityType")
     };
     return obj;
 }
开发者ID:ahaadi,项目名称:markdown-scanner,代码行数:10,代码来源:EntitySet.cs

示例6: FromXml

        public static Annotation FromXml(XElement xml)
        {
            if (xml.Name.LocalName != ElementName) throw new ArgumentException("xml was not an Annotation element");

            var obj = new Annotation
            {
                Term = xml.AttributeValue("Term"),
                String = xml.AttributeValue("String")
            };
            return obj;
        }
开发者ID:ahaadi,项目名称:markdown-scanner,代码行数:11,代码来源:Annotation.cs

示例7: AssemblyPosition

        public static int AssemblyPosition(XElement element)
        {
            var targetFilename = element.AttributeValue("targetFilename");
            if (targetFilename != null)
                return AssemblyPosition(Path.GetFileName(targetFilename));

            var path = element.AttributeValue("path");
            if (path != null)
                return AssemblyPosition(Path.GetFileName(path));

            return 0;
        }
开发者ID:JustAndrei,项目名称:C1-Packages,代码行数:12,代码来源:ReferencedAssemblies.cs

示例8: FromXml

        internal static ReturnType FromXml(XElement xml)
        {
            if (xml.Name.LocalName != ElementName) throw new ArgumentException("xml wasn't a ReturnType element");

            var obj = new ReturnType
            {
                Type = xml.AttributeValue("Type"),
                Nullable = xml.AttributeValue("Nullable").ToBoolean()
            };

            return obj;
        }
开发者ID:ahaadi,项目名称:markdown-scanner,代码行数:12,代码来源:ReturnType.cs

示例9: FromXml

        public static Property FromXml(XElement xml)
        {
            if (xml.Name.LocalName != ElementName) throw new ArgumentException("xml wasn't a Property element");

            var obj = new Property
            {
                Name = xml.AttributeValue("Name"),
                Type = xml.AttributeValue("Type"),
                Nullable = xml.AttributeValue("Nullable").ToBoolean()
            };

            return obj;
        }
开发者ID:ahaadi,项目名称:markdown-scanner,代码行数:13,代码来源:Property.cs

示例10: FromXml

        public static Term FromXml(XElement xml)
        {
            if (xml.Name.LocalName != ElementName) throw new ArgumentException("xml was not a Term element");

            var obj = new Term
            {
                Name = xml.AttributeValue("Name"),
                Type = xml.AttributeValue("Type"),
                AppliesTo = xml.AttributeValue("AppliesTo")
            };
            obj.Annotations.AddRange(from e in xml.Elements()
                                     where e.Name.LocalName == Annotation.ElementName
                                     select Annotation.FromXml(e));
            return obj;
        }
开发者ID:ahaadi,项目名称:markdown-scanner,代码行数:15,代码来源:Term.cs

示例11: CruiseControlNetBuildStatus

        public CruiseControlNetBuildStatus(XElement projectElem)
        {
            Name = BuildDefinitionId = projectElem.AttributeValue("name");

            BuildStatusInfo buildStatusInfo;
            if (!_buildStatusInfo.TryGetValue(BuildDefinitionId, out buildStatusInfo))
            {
                buildStatusInfo = new BuildStatusInfo();
                _buildStatusInfo.Add(BuildDefinitionId, buildStatusInfo);
            }

            var lastBuildTimeStr = projectElem.AttributeValueOrDefault("lastBuildTime");
            DateTime dt;
            DateTime? lastBuildTime = null;
            if (DateTime.TryParse(lastBuildTimeStr, out dt))
            {
                lastBuildTime = dt;
            }

            BuildStatusEnum = ToBuildStatusEnum(projectElem.AttributeValueOrDefault("activity"), projectElem.AttributeValueOrDefault("lastBuildStatus"));
            StartedTime = GetStartedTime(buildStatusInfo, BuildStatusEnum, lastBuildTime);
            FinishedTime = GetFinishedTime(buildStatusInfo, BuildStatusEnum, lastBuildTime);
            Comment = null;
            RequestedBy = GetRequestedBy(projectElem);

            var webUrl = projectElem.AttributeValueOrDefault("webUrl");
            string lastBuildTimeAsId = ParseCruiseControlDateToId(lastBuildTimeStr);
            Url = string.Format("{0}/server/local/project/{1}/build/log{2}.xml/ViewBuildReport.aspx", webUrl, Name, lastBuildTimeAsId);
            BuildId = GetBuildIdOrDefault(projectElem, lastBuildTimeAsId);

            buildStatusInfo.LastBuildStatusEnum = BuildStatusEnum;
        }
开发者ID:jimbobTX,项目名称:SirenOfShame,代码行数:32,代码来源:CruiseControlNetBuildStatus.cs

示例12: FromXml

 public static Action FromXml(XElement xml)
 {
     if (xml.Name.LocalName != ElementName) throw new ArgumentException("xml was not a Action element");
     var obj = new Action
     {
         Name = xml.AttributeValue("Name"),
         IsBound = xml.AttributeValue("IsBound").ToBoolean()
     };
     obj.Parameters.AddRange(from e in xml.Elements()
                             where e.Name == Parameter.ElementName
                             select Parameter.FromXml(e));
     obj.ReturnType = (from e in xml.Elements()
                       where e.Name.LocalName == ReturnType.ElementName
                       select ReturnType.FromXml(e)).FirstOrDefault();
     return obj;
 }
开发者ID:ahaadi,项目名称:markdown-scanner,代码行数:16,代码来源:Action.cs

示例13: Parse

 public TcProject Parse(string xml)
 {
     xElement = XElement.Parse(xml);
     var id = xElement.AttributeValue("id");
     var tcProject = new TcProject(id);
     var xElements = xElement.Elements("build-type");
     xElements.ForEach(AddBuildConfigurationToProject(tcProject));
     return tcProject;
 }
开发者ID:sankalpsaxena81,项目名称:SequenceDiagramGeneratorForTeamCityProjects,代码行数:9,代码来源:ProjectFileParser.cs

示例14: FromXml

 public static ComplexType FromXml(XElement xml)
 {
     if (xml.Name.LocalName != ElementName) throw new ArgumentException("xml was not a ComplexType element");
     var obj = new ComplexType { Name = xml.AttributeValue("Name") };
     obj.Properties.AddRange(from e in xml.Elements()
                             where e.Name.LocalName == "Property"
                             select Property.FromXml(e));
     return obj;
 }
开发者ID:ahaadi,项目名称:markdown-scanner,代码行数:9,代码来源:ComplexType.cs

示例15: ExpandableOptionModel

 public ExpandableOptionModel(XElement node, OptionGroupModel model)
 {
     Instance = new ExpandableOption {DataContext = this};
     _model = model;
     Title = node.ChildNodeValue("Title");
     Description = node.ChildNodeValue("Description");
     IsChecked = node.AttributeValue("checked", false);
     DetailsLinkText = node.ChildNodeValue("DetailsText", "more details");
     Branch = node.ChildNodeValue("SettingKey");
     _detailsUrl = node.ChildNodeValue("DetailsUrl");
 }
开发者ID:jardrake03,项目名称:incert,代码行数:11,代码来源:ExpandableOptionModel.cs


注:本文中的System.Xml.Linq.XElement.AttributeValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。