Inheritance: System.Xml.XmlDocument
Exemple #1
0
        /// <summary>
        /// Parses a XAML document using an XmlReader.
        /// </summary>
        public static XamlDocument Parse(XmlReader reader, XamlParserSettings settings)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            XmlDocument doc       = new PositionXmlDocument();
            var         errorSink = (IXamlErrorSink)settings.ServiceProvider.GetService(typeof(IXamlErrorSink));

            try {
                doc.Load(reader);
                return(Parse(doc, settings));
            } catch (XmlException x) {
                if (errorSink != null)
                {
                    errorSink.ReportError(x.Message, x.LineNumber, x.LinePosition);
                }
                else
                {
                    throw;
                }
            }

            return(null);
        }
		/// <summary>
		/// Parses a XAML document using an XmlReader.
		/// </summary>
		public static XamlDocument Parse(XmlReader reader, XamlParserSettings settings)
		{
			if (reader == null)
				throw new ArgumentNullException("reader");
			if (settings == null)
				throw new ArgumentNullException("settings");
			
			XmlDocument doc = new PositionXmlDocument();
			var errorSink = (IXamlErrorSink)settings.ServiceProvider.GetService(typeof(IXamlErrorSink));

			try {
				doc.Load(reader);
				return Parse(doc, settings);
			} catch (XmlException x) {
				if (errorSink != null) {
					errorSink.ReportError(x.Message, x.LineNumber, x.LinePosition);
				} else {
					throw;
				}
			}

			return null;
		}
        internal PositionXmlElement(string prefix, string localName, string namespaceURI, PositionXmlDocument doc, IXmlLineInfo lineInfo)
            : base(prefix, localName, namespaceURI, doc)
        {
            if (lineInfo != null)
            {
                xamlElementLineInfo = new XamlElementLineInfo(lineInfo.LineNumber, lineInfo.LinePosition);
            }

            this.positionXmlDocument = doc;
        }
        internal PositionXmlElement(string prefix, string localName, string namespaceURI, PositionXmlDocument doc, IXmlLineInfo lineInfo)
            : base(prefix, localName, namespaceURI, doc)
        {
            if (lineInfo != null)
            {
                xamlElementLineInfo = new XamlElementLineInfo(lineInfo.LineNumber, lineInfo.LinePosition);
            }

            this.positionXmlDocument = doc;
        }