本文整理汇总了C#中System.Xml.Linq.XAttribute.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# XAttribute.ToString方法的具体用法?C# XAttribute.ToString怎么用?C# XAttribute.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Linq.XAttribute
的用法示例。
在下文中一共展示了XAttribute.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvalidAttributeDateValueException
public InvalidAttributeDateValueException(XAttribute a)
: base(string.Format(
"{0}:{1} Invalid date format given for attribute. Format must be \"yyyy-MM-dd hh:mm:ss\". <{2} {3}>",
a.Document.BaseUri,
((IXmlLineInfo)a).LineNumber, a.Parent.Name, a.ToString()))
{
}
示例2: TryParseAttributeSearchResult
private SearchResult TryParseAttributeSearchResult(XAttribute attribute)
{
if(attribute == null)
{
return null;
}
var searchResult = new SearchResult {Value = attribute.ToString(), SelectionLength = attribute.Name.LocalName.Length};
SetLineInfo(attribute, searchResult);
return searchResult;
}
示例3: BindName
private void BindName(XAttribute attribute, CSharpSyntaxNode originatingSyntax, bool isParameter)
{
XmlNameAttributeSyntax attrSyntax = ParseNameAttribute(attribute.ToString(), attribute.Parent.Name.LocalName);
// CONSIDER: It would be easy to construct an XmlLocation from the XAttribute, so that
// we could point the user at the actual problem.
Location sourceLocation = originatingSyntax.Location;
RecordSyntaxDiagnostics(attrSyntax, sourceLocation); // Respects DocumentationMode.
MemberDeclarationSyntax memberDeclSyntax = BinderFactory.GetAssociatedMemberForXmlSyntax(originatingSyntax);
Debug.Assert(memberDeclSyntax != null,
"Why are we processing a documentation comment that is not attached to a member declaration?");
DiagnosticBag nameDiagnostics = DiagnosticBag.GetInstance();
Binder binder = MakeNameBinder(isParameter, memberSymbol, compilation);
DocumentationCommentCompiler.BindName(attrSyntax, binder, memberSymbol, ref documentedParameters, ref documentedTypeParameters, nameDiagnostics);
RecordBindingDiagnostics(nameDiagnostics, sourceLocation); // Respects DocumentationMode.
nameDiagnostics.Free();
}
示例4: SpecialAttribHandling
private string SpecialAttribHandling(XAttribute attrib)
{
switch (attrib.Name.LocalName)
{
case "Name":
this.namedElements.Add(attrib.Value);
if (String.IsNullOrEmpty(attrib.Name.Namespace.NamespaceName))
{
return String.Format("x:{0}", attrib);
}
return attrib.ToString();
case "Key":
this.keyedElements.Add(attrib.Value);
if (String.IsNullOrEmpty(attrib.Name.Namespace.NamespaceName))
{
return String.Format("x:{0}", attrib);
}
return attrib.ToString();
default:
if (attrib.Value == "#FF000000")
{
Debugger.Break();
}
if (attrib.ToString().StartsWith("xmlns:"))
{
this.namespaces.Add(attrib.Name.LocalName);
}
if (this.replaceList.ContainsKey(attrib.Value))
{
return String.Format("{1}=\"{0}\"", this.replaceList[attrib.Value], attrib.Name.LocalName);
}
return attrib.ToString();
}
}
示例5: GetNamespacePrefixFromXmlnsDeclaration
private string GetNamespacePrefixFromXmlnsDeclaration(XAttribute attribute)
{
var attr = attribute.ToString();
var match = Regex.Match(attr, @"^xmlns:(?'NamespacePrefix'\w+)=");
return match.Success ? match.Groups["NamespacePrefix"].Value : string.Empty;
}
示例6: GetNamespacePrefix
private string GetNamespacePrefix(XAttribute attribute)
{
var attr = attribute.ToString();
var match = Regex.Match(attr, @"^(?'NamespacePrefix'\w+):");
return match.Success ? match.Groups["NamespacePrefix"].Value : string.Empty;
}
示例7: LogError
private void LogError(int errorId, XAttribute attribute, string message)
{
int lineStart = (attribute as IXmlLineInfo).LineNumber;
int columnStart = (attribute as IXmlLineInfo).LinePosition + attribute.ToString().Length - attribute.Value.Length - 1;
int lineEnd = lineStart;
int columnEnd = columnStart + attribute.Value.Length;
// OriginalAndroidManifest contains exactly one element. This has been checked in a previous build-step.
this.LogError(errorId, this.OriginalAndroidManifest[0].ItemSpec, lineStart, columnStart, lineEnd, columnEnd, message);
}
示例8: InvalidAttributeValueException
public InvalidAttributeValueException(XAttribute a)
: base(string.Format("{0}:{1} Invalid Attribute Value <{2} {3}>", a.Document.BaseUri,
((IXmlLineInfo)a).LineNumber, a.Parent.Name, a.ToString()))
{
}