Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@ -39,24 +39,16 @@ using System.Xml.Schema; // only required for NET_2_0 (SchemaInfo)
using System.Xml.Serialization; // only required for NET_2_0 (SchemaInfo)
using Mono.Xml.Schema; // only required for NET_2_0
using Mono.Xml; // only required for NET_2_0
#if NET_4_5
using System.Threading;
using System.Threading.Tasks;
#endif
namespace System.Xml
{
#if NET_2_0
public abstract class XmlReader : IDisposable
#else
public abstract class XmlReader
#endif
{
private StringBuilder readStringBuffer;
private XmlReaderBinarySupport binary;
#if NET_2_0
private XmlReaderSettings settings;
#endif
#region Constructor
@ -85,7 +77,6 @@ namespace System.Xml
}
}
#if NET_2_0
// To enable it internally in sys.xml, just insert these
// two lines into Read():
//
@ -101,15 +92,6 @@ namespace System.Xml
public virtual bool CanReadValueChunk {
get { return false; }
}
#else
internal virtual bool CanReadBinaryContent {
get { return false; }
}
internal virtual bool CanReadValueChunk {
get { return false; }
}
#endif
public virtual bool CanResolveEntity
{
@ -125,7 +107,6 @@ namespace System.Xml
get { return AttributeCount > 0; }
}
#if NET_4_0
public virtual bool HasValue {
get {
switch (NodeType) {
@ -142,13 +123,9 @@ namespace System.Xml
return false;
}
}
#else
public abstract bool HasValue { get; }
#endif
public abstract bool IsEmptyElement { get; }
#if NET_2_0
public virtual bool IsDefault {
get { return false; }
}
@ -164,19 +141,9 @@ namespace System.Xml
public virtual string this [string name, string namespaceURI] {
get { return GetAttribute (name, namespaceURI); }
}
#else
public abstract bool IsDefault { get; }
public abstract string this [int i] { get; }
public abstract string this [string name] { get; }
public abstract string this [string localName, string namespaceName] { get; }
#endif
public abstract string LocalName { get; }
#if NET_2_0
public virtual string Name {
get {
return Prefix.Length > 0 ?
@ -184,9 +151,6 @@ namespace System.Xml
LocalName;
}
}
#else
public abstract string Name { get; }
#endif
public abstract string NamespaceURI { get; }
@ -196,17 +160,12 @@ namespace System.Xml
public abstract string Prefix { get; }
#if NET_2_0
public virtual char QuoteChar {
get { return '\"'; }
}
#else
public abstract char QuoteChar { get; }
#endif
public abstract ReadState ReadState { get; }
#if NET_2_0
public virtual IXmlSchemaInfo SchemaInfo {
get { return null; }
}
@ -214,11 +173,9 @@ namespace System.Xml
public virtual XmlReaderSettings Settings {
get { return settings; }
}
#endif
public abstract string Value { get; }
#if NET_2_0
public virtual string XmlLang {
get { return String.Empty; }
}
@ -226,27 +183,17 @@ namespace System.Xml
public virtual XmlSpace XmlSpace {
get { return XmlSpace.None; }
}
#else
public abstract string XmlLang { get; }
public abstract XmlSpace XmlSpace { get; }
#endif
#endregion
#region Methods
#if NET_4_5
public virtual void Close ()
{
if (asyncRunning)
throw new InvalidOperationException ("An asynchronous operation is already in progress.");
}
#else
public abstract void Close ();
#endif
#if NET_2_0
private static XmlNameTable PopulateNameTable (
XmlReaderSettings settings)
{
@ -319,9 +266,7 @@ namespace System.Xml
copy = new XmlReaderSettings ();
else
copy = src.Clone ();
#if NET_4_5
copy.SetReadOnly ();
#endif
return copy;
}
@ -332,11 +277,9 @@ namespace System.Xml
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;
}
@ -488,11 +431,7 @@ namespace System.Xml
return xvr != null ? xvr : reader;
}
#if NET_4_0
public void Dispose ()
#else
void IDisposable.Dispose()
#endif
{
Dispose (true);
}
@ -502,7 +441,6 @@ namespace System.Xml
if (disposing && ReadState != ReadState.Closed)
Close ();
}
#endif
public abstract string GetAttribute (int i);
@ -543,7 +481,6 @@ namespace System.Xml
public abstract string LookupNamespace (string prefix);
#if NET_2_0
public virtual void MoveToAttribute (int i)
{
if (i >= AttributeCount)
@ -552,9 +489,6 @@ namespace System.Xml
for (int a = 0; a < i; a++)
MoveToNextAttribute ();
}
#else
public abstract void MoveToAttribute (int i);
#endif
public abstract bool MoveToAttribute (string name);
@ -848,7 +782,6 @@ namespace System.Xml
return ret;
}
#if NET_2_0
public virtual Type ValueType {
get { return typeof (string); }
}
@ -1003,7 +936,6 @@ namespace System.Xml
return ReadContentAs (ValueType, null);
}
#if NET_4_5
public virtual DateTimeOffset ReadContentAsDateTimeOffset ()
{
try {
@ -1012,7 +944,6 @@ namespace System.Xml
throw XmlError ("Typed value is invalid.", e);
}
}
#endif
public virtual object ReadElementContentAs (Type returnType, IXmlNamespaceResolver namespaceResolver)
{
@ -1371,7 +1302,6 @@ namespace System.Xml
binary = new XmlReaderBinarySupport (this);
}
#endif
public virtual int ReadValueChunk (char [] buffer, int index, int count)
{
@ -1406,15 +1336,12 @@ namespace System.Xml
{
return new XmlException (this as IXmlLineInfo, BaseURI, message);
}
#if NET_2_0
private XmlException XmlError (string message, Exception innerException)
{
return new XmlException (this as IXmlLineInfo, BaseURI, message);
}
#endif
#endregion
#if NET_4_5
#region .NET 4.5 Async Methods
bool asyncRunning;
@ -1635,6 +1562,5 @@ namespace System.Xml
}
#endregion
#endif
}
}