public XmlAttributePreservationDict GetDictAtPosition(int lineNumber, int linePosition) { if (_reader.ReadToPosition(lineNumber, linePosition)) { Debug.Assert((char)_reader.Peek() == '<'); var sb = new StringBuilder(); int character; bool inAttribute = false; do { character = _reader.Read(); if (character == '\"') { inAttribute = !inAttribute; } sb.Append((char)character); } while (character > 0 && ((char)character != '>' || inAttribute)); if (character > 0) { var dict = new XmlAttributePreservationDict(); dict.ReadPreservationInfo(sb.ToString()); return(dict); } } Debug.Fail("Failed to get preservation info"); return(null); }
internal XmlFileInfoElement( string prefix, string localName, string namespaceUri, XmlFileInfoDocument document) : base(prefix, localName, namespaceUri, document) { LineNumber = document.CurrentLineNumber; LinePosition = document.CurrentLinePosition; IsOriginal = document.FirstLoad; if (document.PreservationProvider != null) { _preservationDict = document.PreservationProvider.GetDictAtPosition(LineNumber, LinePosition - 1); } if (_preservationDict == null) { _preservationDict = new XmlAttributePreservationDict(); } }