Clone() 공개 메소드

public Clone ( ) : XmlReaderSettings
리턴 XmlReaderSettings
예제 #1
0
 static XmlReaderSettings PopulateSettings(XmlReaderSettings src)
 {
     if (src == null)
     {
         return(new XmlReaderSettings());
     }
     else
     {
         return(src.Clone());
     }
 }
예제 #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;
                }
            }
        }
예제 #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);
        }
예제 #4
0
		public XmlFilterReader (XmlReader reader, XmlReaderSettings settings)
		{
			this.reader = reader;
			this.settings = settings.Clone ();
			this.lineInfo = reader as IXmlLineInfo;
		}
예제 #5
0
파일: XmlReader.cs 프로젝트: carrie901/mono
		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;
		}
예제 #6
0
파일: XmlReader.cs 프로젝트: carrie901/mono
		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;
		}
예제 #7
0
		static XmlReaderSettings PopulateSettings (XmlReaderSettings src)
		{
			if (src == null)
				return new XmlReaderSettings ();
			else
				return src.Clone ();
		}
예제 #8
0
		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);
		}
예제 #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;
 }