914cb26e5a65116295678093a96a7888479a258d
[mono.git] / mcs / class / referencesource / System.Data.Entity / System / Data / EntityModel / SchemaObjectModel / TextElement.cs
1 //---------------------------------------------------------------------
2 // <copyright file="TextElement.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner       Microsoft
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
9
10 using System;
11 using System.Collections;
12 using System.Collections.Generic;
13 using System.Text;
14 using System.Xml;
15
16 namespace System.Data.EntityModel.SchemaObjectModel
17 {
18     /// <summary>
19     /// Summary description for Documentation.
20     /// </summary>
21     internal sealed class TextElement : SchemaElement
22     {
23         #region Instance Fields
24         private string _value = null;
25         #endregion
26
27         #region Public Methods
28         /// <summary>
29         /// 
30         /// </summary>
31         /// <param name="parentElement"></param>
32         public TextElement(SchemaElement parentElement)
33         : base(parentElement)
34         {
35         }
36         #endregion
37
38         #region Public Properties
39         /// <summary>
40         /// 
41         /// </summary>
42         public string Value
43         {
44             get
45             {
46                 return _value;
47             }
48             private set
49             {
50                 _value = value;
51             }
52         }
53         #endregion
54
55         #region Protected Properties
56         protected override bool HandleText(XmlReader reader)
57         {
58             TextElementTextHandler(reader);
59             return true;
60         }
61         #endregion
62
63         #region Private Methods
64         /// <summary>
65         /// 
66         /// </summary>
67         /// <param name="reader"></param>
68         private void TextElementTextHandler(XmlReader reader)
69         {
70             string text = reader.Value;
71             if ( string.IsNullOrEmpty(text) )
72                 return;
73
74             if ( string.IsNullOrEmpty(Value) )
75                 Value = text;
76             else
77                 Value += text;
78         }
79         #endregion
80     }
81 }