// Read an attribute value.
	//
	// Already read: ('"' | "'")
	private void ReadAttributeValue
				(StringBuilder log, Segments segments, char quoteChar)
			{
				int segLen = 0;
				int textStart = 0;
				SegmentInfo seg;
				XmlNameTable nt = context.NameTable;

				// push the log onto the logger's log stack
				input.Logger.Push(log);

				// read until we consume all the text
				while(input.PeekChar() && input.peekChar != quoteChar)
				{
					// perform error checks and process segments
					if(input.peekChar == '<')
					{
						Error(/* TODO */);
					}
					else if(input.peekChar == '&')
					{
						// if we have text, add a new text segment to the list
						if(log.Length > textStart)
						{
							int textEnd = (log.Length - textStart);
							seg = segments[segLen++];
							seg.SetInfo(true, log.ToString(textStart, textEnd));
						}

						// remeber position
						int position = log.Length;

						// move to the '&' character
						input.NextChar();

						// read character or entity reference
						String name;
						char ch;
						if(ReadReferenceNormalize(out name, out ch))
						{
							// character reference (e.g. &amp;)
							log.Length = position;
							log.Append(ch);
						}
						else
						{
							// we leave entity refence as it is
							log.Length = position;
							log.Append('&');
							log.Append(name);
							log.Append(';');
						}
						seg = segments[segLen++];
						seg.SetInfo(true, log.ToString(position, log.Length - position));

						// store the start index of the next segment
						textStart = log.Length;
					}
					else
					{
						input.NextChar();
					}
				}

				// if we have text, add a new text segment to the list
				if(log.Length > textStart)
				{
					int textEnd = (log.Length - textStart);
					seg = segments[segLen++];
					seg.SetInfo(true, log.ToString(textStart, textEnd));
				}

				// we need at least one segment
				if(segLen == 0)
				{
					seg = segments[segLen++];
					seg.SetInfo(true, "");
				}

				// store the number of segments
				segments.Count = segLen;

				// pop the log from the logger's log stack
				input.Logger.Pop();
			}
	// Read and normalize an attribute value.
	//
	// Already read: ('"' | "'")
	private void ReadAttributeValueNormalize
				(StringBuilder log, Segments segments, char quoteChar)
			{
				int segLen = 0;
				int textStart = 0;
				SegmentInfo seg;
				XmlNameTable nt = context.NameTable;

				// push the log onto the logger's log stack
				input.Logger.Push(log);

				// read until we consume all the text
				while(input.PeekChar() && input.peekChar != quoteChar)
				{
					// perform error checks and process segments
					if(input.peekChar == '<')
					{
						Error(/* TODO */);
					}
					else if(input.peekChar == '&')
					{
						bool haveText = (log.Length > textStart);
						int textEnd = (log.Length - textStart);
						int position = log.Length;
						String s; char c;

						// move to the '&' character
						input.NextChar();

						// read the reference
						if(ReadReferenceNormalize(out s, out c))
						{
							log.Length = position;
							log.Append(c);
						}
						else
						{
							// if we have text, add a new text segment to the list
							if(haveText)
							{
								seg = segments[segLen++];
								seg.SetInfo(true, log.ToString(textStart, textEnd));
							}

							// add a new reference segment to the list
							seg = segments[segLen++];
							seg.SetInfo(false, nt.Add(s));

							// store the start index of the next segment
							textStart = log.Length;
						}
					}
					else if(XmlCharInfo.IsWhitespace(input.peekChar))
					{
						// skip whitespace without logging
						input.Logger.Pop();
						input.SkipWhitespace();
						input.Logger.Push(log);

						// set whitespace to single space character
						log.Append(' ');
					}
					else
					{
						input.NextChar();
					}
				}

				// if we have text, add a new text segment to the list
				if(log.Length > textStart)
				{
					int textEnd = (log.Length - textStart);
					seg = segments[segLen++];
					seg.SetInfo(true, log.ToString(textStart, textEnd));
				}

				// we need at least one segment
				if(segLen == 0)
				{
					seg = segments[segLen++];
					seg.SetInfo(true, "");
				}

				// store the number of segments
				segments.Count = segLen;

				// pop the log from the logger's log stack
				input.Logger.Pop();
			}
Example #3
0
 public TextInfo(int capacity)
 {
     this.index    = 0;
     this.segments = new Segments(capacity);
 }
Example #4
0
 // Set the node information.
 public void SetInfo(Segments segments)
 {
     this.index    = 0;
     this.segments = segments;
 }
Example #5
0
 // Constructors.
 public TextInfo()
 {
     this.index    = 0;
     this.segments = new Segments();
 }
	// Set the node information.
	public void SetInfo(Segments segments)
			{
				this.index = 0;
				this.segments = segments;
			}
	public TextInfo(int capacity)
			{
				this.index = 0;
				this.segments = new Segments(capacity);
			}
	// Constructors.
	public TextInfo()
			{
				this.index = 0;
				this.segments = new Segments();
			}
	// Set the node information.
	public void SetInfo
				(Segments segments, char quoteChar, String name, String value)
			{
				useIter = false;
				iter.SetInfo(segments);
				this.quoteChar = quoteChar;
				this.localName = name;
				this.name = name;
				this.namespaceURI = String.Empty;
				this.prefix = String.Empty;
				this.value = value;
			}