// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Collections.Generic;
-#endif
using System;
using System.Globalization;
using System.IO;
namespace Mono.Xml
{
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
- internal class EntityResolvingXmlReader : XmlReader,
-#if NET_2_0
- IXmlNamespaceResolver,
-#endif
+ internal class EntityResolvingXmlReader : XmlReader, IXmlNamespaceResolver,
IXmlLineInfo, IHasXmlParserContext
{
EntityResolvingXmlReader entity;
bool inside_attr;
bool do_resolve;
- public EntityResolvingXmlReader (XmlReader source, XmlParserContext context)
+ public EntityResolvingXmlReader (XmlReader source)
{
this.source = source;
- this.context = context;
+ IHasXmlParserContext container = source as IHasXmlParserContext;
+ if (container != null)
+ this.context = container.ParserContext;
+ else
+ this.context = new XmlParserContext (source.NameTable, new XmlNamespaceManager (source.NameTable), null, XmlSpace.None);
}
EntityResolvingXmlReader (XmlReader entityContainer,
get { return entity != null && entity.ReadState != ReadState.Initial ? (XmlReader) entity : source; }
}
-#if NET_2_0
-#else
- public override string this [int i] {
- get { return GetAttribute (i); }
- }
-
- public override string this [string name] {
- get { return GetAttribute (name); }
- }
-
- public override string this [string localName, string namespaceName] {
- get { return GetAttribute (localName, namespaceName); }
- }
-#endif
-
public override int AttributeCount {
get { return Current.AttributeCount; }
}
return Current.GetAttribute (localName, namespaceURI);
}
-#if NET_2_0
public IDictionary<string, string> GetNamespacesInScope (XmlNamespaceScope scope)
{
return ((IXmlNamespaceResolver) Current).GetNamespacesInScope (scope);
{
return ((IXmlNamespaceResolver) Current).LookupPrefix (ns);
}
-#endif
public override string LookupNamespace (string prefix)
{
public override void ResolveEntity ()
{
-#if NET_2_0
DoResolveEntity ();
-#else
- do_resolve = true;
-#endif
}
void DoResolveEntity ()