Clone() public method

public Clone ( ) : XmlReaderSettings
return XmlReaderSettings
Example #1
0
 static XmlReaderSettings PopulateSettings(XmlReaderSettings src)
 {
     if (src == null)
     {
         return(new XmlReaderSettings());
     }
     else
     {
         return(src.Clone());
     }
 }
Example #2
0
        public QueryReaderSettings(XmlReader reader)
        {
#pragma warning disable 618
            XmlValidatingReader valReader = reader as XmlValidatingReader;
#pragma warning restore 618
            if (valReader != null)
            {
                // Unwrap validation reader
                _validatingReader = true;
                reader = valReader.Impl.Reader;
            }
            _xmlReaderSettings = reader.Settings;
            if (_xmlReaderSettings != null)
            {
                _xmlReaderSettings = _xmlReaderSettings.Clone();
                _xmlReaderSettings.NameTable = reader.NameTable;
                _xmlReaderSettings.CloseInput = true;
                _xmlReaderSettings.LineNumberOffset = 0;
                _xmlReaderSettings.LinePositionOffset = 0;
                XmlTextReaderImpl impl = reader as XmlTextReaderImpl;
                if (impl != null)
                {
                    _xmlReaderSettings.XmlResolver = impl.GetResolver();
                }
            }
            else
            {
                _xmlNameTable = reader.NameTable;
                XmlTextReader xmlTextReader = reader as XmlTextReader;
                if (xmlTextReader != null)
                {
                    XmlTextReaderImpl impl = xmlTextReader.Impl;
                    _entityHandling = impl.EntityHandling;
                    _namespaces = impl.Namespaces;
                    _normalization = impl.Normalization;
                    _prohibitDtd = (impl.DtdProcessing == DtdProcessing.Prohibit);
                    _whitespaceHandling = impl.WhitespaceHandling;
                    _xmlResolver = impl.GetResolver();
                }
                else
                {
                    _entityHandling = EntityHandling.ExpandEntities;
                    _namespaces = true;
                    _normalization = true;
                    _prohibitDtd = true;
                    _whitespaceHandling = WhitespaceHandling.All;
                    _xmlResolver = null;
                }
            }
        }
Example #3
0
        internal XmlReader CreateReader(string inputUri, XmlParserContext inputContext)
        {
            XmlReader reader;

            if (inputUri == null)
            {
                throw new ArgumentNullException("inputUri");
            }
            if (inputUri.Length == 0)
            {
                throw new ArgumentException(Res.GetString("XmlConvert_BadUri"), "inputUri");
            }
            System.Xml.XmlResolver xmlResolver = this.GetXmlResolver();
            if (xmlResolver == null)
            {
                xmlResolver = this.CreateDefaultResolver();
            }
            Uri    absoluteUri = xmlResolver.ResolveUri(null, inputUri);
            Stream input       = (Stream)xmlResolver.GetEntity(absoluteUri, string.Empty, typeof(Stream));

            if (input == null)
            {
                throw new XmlException("Xml_CannotResolveUrl", inputUri);
            }
            XmlReaderSettings settings = this;

            if (!settings.CloseInput)
            {
                settings            = settings.Clone();
                settings.CloseInput = true;
            }
            try
            {
                reader = settings.CreateReader(input, absoluteUri, null, inputContext);
            }
            catch
            {
                input.Close();
                throw;
            }
            return(reader);
        }
Example #4
0
		public XmlFilterReader (XmlReader reader, XmlReaderSettings settings)
		{
			this.reader = reader;
			this.settings = settings.Clone ();
			this.lineInfo = reader as IXmlLineInfo;
		}
Example #5
0
		static XmlReaderSettings PopulateSettings (XmlReader reader, XmlReaderSettings src)
		{
			XmlReaderSettings copy;
			if (src == null)
				copy = new XmlReaderSettings ();
			else
				copy = src.Clone ();
#if NET_4_5
			if (reader.Settings != null)
				copy.Async = reader.Settings.Async;
			copy.SetReadOnly ();
#endif
			return copy;
		}
Example #6
0
		static XmlReaderSettings PopulateSettings (XmlReaderSettings src)
		{
			XmlReaderSettings copy;
			if (src == null)
				copy = new XmlReaderSettings ();
			else
				copy = src.Clone ();
#if NET_4_5
			copy.SetReadOnly ();
#endif
			return copy;
		}
		static XmlReaderSettings PopulateSettings (XmlReaderSettings src)
		{
			if (src == null)
				return new XmlReaderSettings ();
			else
				return src.Clone ();
		}
		public void AsyncPropagation ()
		{
			var s = new XmlReaderSettings ();
			s.Async = true;
			var r = XmlReader.Create (new StringReader ("<root/>"), s);

			var c = s.Clone ();
			Assert.IsTrue (c.Async);
			c.Reset ();
			Assert.IsFalse (c.Async);

			var r2 = XmlReader.Create (r, c);
			Assert.IsTrue (r2.Settings.Async);
		}
Example #9
0
 public int v4()
 {
     XmlReaderSettings rs = new XmlReaderSettings();
     XmlReaderSettings crs = rs.Clone();
     CError.Compare(rs.CheckCharacters, crs.CheckCharacters, "CheckCharacters");
     CError.Compare(rs.CloseInput, crs.CloseInput, "CloseInput");
     CError.Compare(rs.DtdProcessing, crs.DtdProcessing, "ProhibitDtd");
     CError.Compare(rs.IgnoreComments, crs.IgnoreComments, "IgnoreComments");
     CError.Compare(rs.IgnoreProcessingInstructions, crs.IgnoreProcessingInstructions, "IgnorePI");
     CError.Compare(rs.IgnoreWhitespace, crs.IgnoreWhitespace, "IgnoreWhitespace");
     CError.Compare(rs.LineNumberOffset, crs.LineNumberOffset, "LineNumberOffset");
     CError.Compare(rs.LinePositionOffset, crs.LinePositionOffset, "LinePositionOffset");
     CError.Compare(rs.MaxCharactersInDocument, crs.MaxCharactersInDocument, "maxcharsindoc");
     CError.Compare(rs.NameTable, crs.NameTable, "NameTable");
     CError.Compare(rs.ConformanceLevel, crs.ConformanceLevel, "ConformanceLevel");
     CError.Compare(rs.GetType(), crs.GetType(), "GetType");
     return TEST_PASS;
 }