Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System.XML/System.Xml/XmlReader.cs')
-rw-r--r--mcs/class/System.XML/System.Xml/XmlReader.cs51
1 files changed, 35 insertions, 16 deletions
diff --git a/mcs/class/System.XML/System.Xml/XmlReader.cs b/mcs/class/System.XML/System.Xml/XmlReader.cs
index 22c80018f59..cca9b144a37 100644
--- a/mcs/class/System.XML/System.Xml/XmlReader.cs
+++ b/mcs/class/System.XML/System.Xml/XmlReader.cs
@@ -647,18 +647,35 @@ namespace System.Xml
Read ();
}
+#if NET_1_0
+ public abstract string ReadInnerXml ();
+
+ public abstract string ReadOuterXml ();
+
+#else
public virtual string ReadInnerXml ()
{
+ return ReadInnerXmlInternal ();
+ }
+
+ public virtual string ReadOuterXml ()
+ {
+ return ReadOuterXmlInternal ();
+ }
+#endif
+
+ internal string ReadInnerXmlInternal ()
+ {
if (ReadState != ReadState.Interactive || NodeType == XmlNodeType.EndElement)
return String.Empty;
- if (IsEmptyElement) {
- Read ();
- return String.Empty;
- }
StringWriter sw = new StringWriter ();
XmlTextWriter xtw = new XmlTextWriter (sw);
if (NodeType == XmlNodeType.Element) {
+ if (IsEmptyElement) {
+ Read ();
+ return String.Empty;
+ }
int startDepth = Depth;
Read ();
while (startDepth < Depth) {
@@ -675,22 +692,15 @@ namespace System.Xml
return sw.ToString ();
}
- public virtual string ReadOuterXml ()
+ internal string ReadOuterXmlInternal ()
{
if (ReadState != ReadState.Interactive || NodeType == XmlNodeType.EndElement)
return String.Empty;
- switch (NodeType) {
- case XmlNodeType.Element:
- case XmlNodeType.Attribute:
- StringWriter sw = new StringWriter ();
- XmlTextWriter xtw = new XmlTextWriter (sw);
- xtw.WriteNode (this, false);
- return sw.ToString ();
- default:
- Skip ();
- return String.Empty;
- }
+ StringWriter sw = new StringWriter ();
+ XmlTextWriter xtw = new XmlTextWriter (sw);
+ xtw.WriteNode (this, false);
+ return sw.ToString ();
}
public virtual void ReadStartElement ()
@@ -739,8 +749,17 @@ namespace System.Xml
Read ();
}
+#if NET_1_0
+ public abstract string ReadString ();
+#else
public virtual string ReadString ()
{
+ return ReadStringInternal ();
+ }
+#endif
+
+ internal string ReadStringInternal ()
+ {
if (readStringBuffer == null)
readStringBuffer = new StringBuilder ();
readStringBuffer.Length = 0;