Exemplo n.º 1
0
        public XamlXmlParser(XmlReader xmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
        {
            if (xmlReader == null)
            {
                throw new ArgumentNullException("xmlReader");
            }
            if (schemaContext == null)
            {
                throw new ArgumentNullException("schemaContext");
            }

            sctx          = schemaContext;
            this.settings = settings ?? new XamlXmlReaderSettings();

            // filter out some nodes.
            var xrs = new XmlReaderSettings()
            {
                CloseInput     = this.settings.CloseInput,
                IgnoreComments = true,
                IgnoreProcessingInstructions = true,
                IgnoreWhitespace             = true
            };

            r         = XmlReader.Create(xmlReader, xrs);
            line_info = r as IXmlLineInfo;
            xaml_namespace_resolver = new NamespaceResolver(r as IXmlNamespaceResolver);
        }
Exemplo n.º 2
0
        static XmlReader CreateReader(TextReader reader, XamlXmlReaderSettings settings)
        {
            if (settings?.RequiresXmlContext != true)
            {
                return(XmlReader.Create(reader, CreateReaderSettings(settings)));
            }

            return(XmlReader.Create(reader, CreateReaderSettings(settings, ConformanceLevel.Fragment), settings.CreateXmlContext()));
        }
Exemplo n.º 3
0
 static XmlReaderSettings CreateReaderSettings(XamlXmlReaderSettings settings, ConformanceLevel conformance = ConformanceLevel.Document, bool?closeInput = null)
 {
     return(new XmlReaderSettings
     {
         CloseInput = closeInput ?? settings?.CloseInput ?? false,
         IgnoreComments = true,
         IgnoreProcessingInstructions = true,
         ConformanceLevel = conformance
     });
 }
		public XamlXmlReaderSettings (XamlXmlReaderSettings settings)
			: base (settings)
		{
			var s = settings;
			if (s == null)
				return;
			CloseInput = s.CloseInput;
			SkipXmlCompatibilityProcessing = s.SkipXmlCompatibilityProcessing;
			XmlLang = s.XmlLang;
			XmlSpacePreserve = s.XmlSpacePreserve;
		}
Exemplo n.º 5
0
        static XmlReader CreateReader(XmlReader xmlReader, XamlXmlReaderSettings settings)
        {
            if (settings?.RequiresXmlContext != true)
            {
                return(XmlReader.Create(xmlReader, CreateReaderSettings(settings)));
            }

            // need to read from a TextReader to load a fragment, so we copy the xml of the current reader
            xmlReader.Read();
            var reader = new StringReader(xmlReader.ReadOuterXml());

            return(XmlReader.Create(reader, CreateReaderSettings(settings, ConformanceLevel.Fragment), settings.CreateXmlContext()));
        }
Exemplo n.º 6
0
        public XamlXmlReaderSettings(XamlXmlReaderSettings settings)
            : base(settings)
        {
            var s = settings;

            if (s == null)
            {
                return;
            }
            CloseInput = s.CloseInput;
            SkipXmlCompatibilityProcessing = s.SkipXmlCompatibilityProcessing;
            XmlLang          = s.XmlLang;
            XmlSpacePreserve = s.XmlSpacePreserve;
        }
Exemplo n.º 7
0
        public XamlXmlReaderSettings(XamlXmlReaderSettings settings)
            : base(settings)
        {
            var s = settings;

            if (s == null)
            {
                return;
            }
            CloseInput = s.CloseInput;
            SkipXmlCompatibilityProcessing = s.SkipXmlCompatibilityProcessing;
            XmlLang          = s.XmlLang;
            XmlSpacePreserve = s.XmlSpacePreserve;
            if (s._defaultNamespaces != null)
            {
                _defaultNamespaces = new Dictionary <string, string>(s._defaultNamespaces);
            }
        }
Exemplo n.º 8
0
        public XamlXmlParser(XmlReader xmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
        {
            if (xmlReader == null)
            {
                throw new ArgumentNullException(nameof(xmlReader));
            }
            if (schemaContext == null)
            {
                throw new ArgumentNullException(nameof(schemaContext));
            }

            sctx          = schemaContext;
            this.settings = settings ?? default_settings;

            r         = xmlReader;
            line_info = r as IXmlLineInfo;
            xaml_namespace_resolver = new NamespaceResolver(r as IXmlNamespaceResolver);
        }
Exemplo n.º 9
0
        public XamlXmlParser(XmlReader xmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
        {
            if (xmlReader == null)
            {
                throw new ArgumentNullException(nameof(xmlReader));
            }
            if (schemaContext == null)
            {
                throw new ArgumentNullException(nameof(schemaContext));
            }

            sctx          = schemaContext;
            this.settings = settings ?? default_settings;
            if (settings?.SkipXmlCompatibilityProcessing != true)
            {
                xmlReader = new CompatibleXmlReader(xmlReader, schemaContext);
            }

            r         = xmlReader;
            line_info = r as IXmlLineInfo;
            xaml_namespace_resolver = new NamespaceResolver(r as IXmlNamespaceResolver);
        }
Exemplo n.º 10
0
		public XamlXmlReader (TextReader textReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
			: this (XmlReader.Create (textReader), schemaContext, settings)
		{
		}
Exemplo n.º 11
0
		public XamlXmlReader (string fileName, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
		{
			throw new NotSupportedException ("Cannot load directly from a file with this profile");
		}
Exemplo n.º 12
0
		public XamlXmlReader (string fileName, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
			: this (XmlReader.Create (fileName, file_reader_settings), schemaContext, settings)
		{
		}
Exemplo n.º 13
0
 public XamlXmlReader(XmlReader xmlReader, XamlXmlReaderSettings settings)
     : this(xmlReader, new XamlSchemaContext(null, null), settings)
 {
 }
Exemplo n.º 14
0
 public XamlXmlReader(Stream stream, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
     : this(XmlReader.Create(stream), schemaContext, settings)
 {
 }
Exemplo n.º 15
0
 public XamlXmlReader(Stream stream, XamlXmlReaderSettings settings)
     : this(stream, new XamlSchemaContext(null, null), settings)
 {
 }
Exemplo n.º 16
0
 public XamlXmlReader(string fileName, XamlXmlReaderSettings settings)
     : this(fileName, new XamlSchemaContext(null, null), settings)
 {
 }
Exemplo n.º 17
0
 public XamlXmlReader(XmlReader xmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
 {
     parser = new XamlXmlParser(xmlReader, schemaContext, settings);
 }
Exemplo n.º 18
0
 public XamlXmlReader(Stream stream, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
 {
     Initialize(CreateReader(stream, settings), schemaContext, settings);
 }
Exemplo n.º 19
0
		public XamlXmlReader (XmlReader xmlReader, XamlXmlReaderSettings settings)
			: this (xmlReader, new XamlSchemaContext (null, null), settings)
		{
		}
Exemplo n.º 20
0
 public XamlXmlReader(string fileName, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
 {
     Initialize(CreateReader(fileName, settings), schemaContext, settings);
 }
Exemplo n.º 21
0
		public XamlXmlReader (Stream stream, XamlXmlReaderSettings settings)
			: this (stream, new XamlSchemaContext (null, null), settings)
		{
		}
Exemplo n.º 22
0
		public XamlXmlReader (XmlReader xmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
		{
			parser = new XamlXmlParser (xmlReader, schemaContext, settings);
		}
Exemplo n.º 23
0
 static XmlReader CreateReader(string fileName, XamlXmlReaderSettings settings)
 {
     return(CreateReader(XmlReader.Create(fileName, CreateReaderSettings(settings, closeInput: true)), settings));
 }
Exemplo n.º 24
0
 public XamlXmlReader(XmlReader xmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
 {
     Initialize(CreateReader(xmlReader, settings), schemaContext, settings);
 }
Exemplo n.º 25
0
 void Initialize(XmlReader xmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
 {
     parser = new XamlXmlParser(xmlReader, schemaContext, settings);
 }
Exemplo n.º 26
0
		public XamlXmlParser (XmlReader xmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
		{
			if (xmlReader == null)
				throw new ArgumentNullException ("xmlReader");
			if (schemaContext == null)
				throw new ArgumentNullException ("schemaContext");

			sctx = schemaContext;
			this.settings = settings ?? new XamlXmlReaderSettings ();

			// filter out some nodes.
			var xrs = new XmlReaderSettings () {
				CloseInput = this.settings.CloseInput,
				IgnoreComments = true,
				IgnoreProcessingInstructions = true,
				IgnoreWhitespace = true };

			r = XmlReader.Create (xmlReader, xrs);
			line_info = r as IXmlLineInfo;
			xaml_namespace_resolver = new NamespaceResolver (r as IXmlNamespaceResolver);
		}
Exemplo n.º 27
0
 public XamlXmlReader(string fileName, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
 {
     throw new NotSupportedException("Cannot load directly from a file with this profile");
 }
Exemplo n.º 28
0
		public XamlXmlReader (string fileName, XamlXmlReaderSettings settings)
			: this (fileName, new XamlSchemaContext (null, null), settings)
		{
		}
Exemplo n.º 29
0
 public XamlXmlReader(string fileName, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
     : this(XmlReader.Create(fileName, file_reader_settings), schemaContext, settings)
 {
 }
Exemplo n.º 30
0
		public XamlXmlReader (Stream stream, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
			: this (XmlReader.Create (stream), schemaContext, settings)
		{
		}
Exemplo n.º 31
0
 public XamlXmlReader(TextReader textReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
     : this(XmlReader.Create(textReader), schemaContext, settings)
 {
 }