Example #1
0
        /// <summary>
        /// Constructor with location information
        /// </summary>
        public XmlAttributeWithLocation(string prefix, string localName, string namespaceURI, XmlDocument document, int lineNumber, int columnNumber)
            : base(prefix, localName, namespaceURI, document)
        {
            XmlDocumentWithLocation documentWithLocation = (XmlDocumentWithLocation)document;

            _elementLocation = ElementLocation.Create(documentWithLocation.FullPath, lineNumber, columnNumber);
        }
Example #2
0
        /// <summary>
        /// Private constructor to give static semantics
        /// </summary>
        private ProjectParser(XmlDocumentWithLocation document, ProjectRootElement project)
        {
            ErrorUtilities.VerifyThrowInternalNull(project, "project");
            ErrorUtilities.VerifyThrowInternalNull(document, "document");

            _document = document;
            _project  = project;
        }
Example #3
0
 /// <summary>
 /// Parses the document into the provided ProjectRootElement.
 /// Throws InvalidProjectFileExceptions for syntax errors.
 /// </summary>
 /// <remarks>
 /// The code markers here used to be around the Project class constructor in the old code.
 /// In the new code, that's not very interesting; we are repurposing to wrap parsing the XML.
 /// </remarks>
 internal static void Parse(XmlDocumentWithLocation document, ProjectRootElement projectRootElement)
 {
     MSBuildEventSource.Log.ParseStart(projectRootElement.ProjectFileLocation.File);
     {
         ProjectParser parser = new ProjectParser(document, projectRootElement);
         parser.Parse();
     }
     MSBuildEventSource.Log.ParseStop(projectRootElement.ProjectFileLocation.File);
 }
Example #4
0
        /// <summary>
        /// Constructor with location information
        /// </summary>
        public XmlElementWithLocation(string prefix, string localName, string namespaceURI, XmlDocumentWithLocation document, int lineNumber, int columnNumber)
            : base(prefix, localName, namespaceURI, document)
        {
            // Subtract one, just to give the same value as the old code did.
            // In the past we pointed to the column of the open angle bracket whereas the XmlTextReader points to the first character of the element name.
            // In well formed XML these are always adjacent on the same line, so it's safe to subtract one.
            // If we're loading from a stream it's zero, so don't subtract one.
            XmlDocumentWithLocation documentWithLocation = (XmlDocumentWithLocation)document;

            int adjustedColumn = (columnNumber == 0) ? columnNumber : columnNumber - 1;

            _elementLocation = ElementLocation.Create(documentWithLocation.FullPath, lineNumber, adjustedColumn);
        }
Example #5
0
 /// <summary>
 /// Constructor without location information
 /// </summary>
 public XmlElementWithLocation(string prefix, string localName, string namespaceURI, XmlDocumentWithLocation document)
     : this(prefix, localName, namespaceURI, document, 0, 0)
 {
 }