ReadChars() public method

public ReadChars ( char buffer, int index, int count ) : int
buffer char
index int
count int
return int
 [MonoTODO] // FIXME: Check how expanded entity is handled here.
 public int ReadChars(char [] buffer, int offset, int length)
 {
     if (entity != null)
     {
         return(entity.ReadChars(buffer, offset, length));
     }
     else
     {
         return(source.ReadChars(buffer, offset, length));
     }
 }
Example #2
0
 [MonoTODO]         // FIXME: Check how expanded entity is handled here.
 public int ReadChars(char [] buffer, int index, int count)
 {
     if (entity != null)
     {
         return(entity.ReadChars(buffer, index, count));
     }
     else
     {
         return(source.ReadChars(buffer, index, count));
     }
 }
Example #3
0
		[Test] // bug #675384
		public void ReadCharsWithVeryLimitedBuffer ()
		{
			var r = new XmlTextReader ("<root><child>a</child></root>", XmlNodeType.Document, null);
			r.MoveToContent ();
			char [] buff = new char [1];
			int read = 0;
			var sb = new StringBuilder ();
			do {
				read = r.ReadChars (buff, 0, buff.Length);
			if (read > 0)
				sb.Append (buff [0]);
			} while (read > 0);
			Assert.AreEqual ("<child>a</child>", sb.ToString (), "#1");
		}
Example #4
0
		[Test] // bug #80308
		public void ReadCharsNested ()
		{
			char[] buf = new char [4];

			string xml = "<root><text>AAAA</text></root>";
			string [] strings = new string [] {
				"<tex", "t>AA", "AA</", "text", ">"};
			XmlTextReader r = new XmlTextReader (
				xml, XmlNodeType.Document, null);
			int c, n = 0;
			while (r.Read ())
				if (r.NodeType == XmlNodeType.Element)
					while ((c = r.ReadChars (buf, 0, buf.Length)) > 0)
						Assert.AreEqual (strings [n++], new string (buf, 0, c), "at " + n);
			Assert.AreEqual (5, n, "total lines");
		}