本文整理匯總了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")
);
}
示例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"));
}
示例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;
}
示例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)));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}