當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。