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()))
 {
 }
 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;
 }
            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();
            }
        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();
            }
        }
 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;
 }
 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;
 }
        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);
        }
 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()))
 {
 }