From ad41847caaa5fe7bc69771b0af206b235d24d339 Mon Sep 17 00:00:00 2001 From: Tim Coleman Date: Sun, 25 Aug 2002 22:04:31 +0000 Subject: 2002-08-25 Tim Coleman * XmlNode.cs: Change CreateNavigator to not be virtual. * XmlElement.cs: Add set_Prefix and InnerText accessors. * XmlEntityReference.cs: Add set_Value accessor. * XmlTextWriter.cs: Make objects which should be private private. * XmlWriter.cs: Remove WriteStartElementInternal abstract definition. * XmlValidatingReader.cs: New stubs added. svn path=/trunk/mcs/; revision=7034 --- mcs/class/System.XML/System.Xml/ChangeLog | 14 + mcs/class/System.XML/System.Xml/XmlElement.cs | 14 +- .../System.XML/System.Xml/XmlEntityReference.cs | 2 + mcs/class/System.XML/System.Xml/XmlNode.cs | 2 +- mcs/class/System.XML/System.Xml/XmlTextWriter.cs | 50 +-- .../System.XML/System.Xml/XmlValidatingReader.cs | 335 +++++++++++++++++++++ mcs/class/System.XML/System.Xml/XmlWriter.cs | 10 +- 7 files changed, 392 insertions(+), 35 deletions(-) create mode 100644 mcs/class/System.XML/System.Xml/XmlValidatingReader.cs (limited to 'mcs/class/System.XML/System.Xml') diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index a44fce96d1b..35802d27442 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,17 @@ +2002-08-25 Tim Coleman + * XmlNode.cs: + Change CreateNavigator to not be virtual. + * XmlElement.cs: + Add set_Prefix and InnerText accessors. + * XmlEntityReference.cs: + Add set_Value accessor. + * XmlTextWriter.cs: + Make objects which should be private private. + * XmlWriter.cs: + Remove WriteStartElementInternal abstract definition. + * XmlValidatingReader.cs: + New stubs added. + 2002-08-22 Jason Diamond * XmlAttributeCollection.cs, XmlElement.cs: Implementation of RemoveAll diff --git a/mcs/class/System.XML/System.Xml/XmlElement.cs b/mcs/class/System.XML/System.Xml/XmlElement.cs index 5c346024596..da26a8b0ca9 100644 --- a/mcs/class/System.XML/System.Xml/XmlElement.cs +++ b/mcs/class/System.XML/System.Xml/XmlElement.cs @@ -51,6 +51,15 @@ namespace System.Xml get { return attributes.Count > 0; } } + [MonoTODO ("Setter.")] + public override string InnerText { + get { + // Not sure why this is an override. Passing through for now. + return base.InnerText; + } + set { throw new NotImplementedException (); } + } + [MonoTODO ("Setter.")] public override string InnerXml { get { @@ -108,9 +117,8 @@ namespace System.Xml } public override string Prefix { - get { - return prefix; - } + get { return prefix; } + set { prefix = value; } } #endregion diff --git a/mcs/class/System.XML/System.Xml/XmlEntityReference.cs b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs index b0b4aae79c9..17e5e29ed20 100644 --- a/mcs/class/System.XML/System.Xml/XmlEntityReference.cs +++ b/mcs/class/System.XML/System.Xml/XmlEntityReference.cs @@ -45,6 +45,8 @@ namespace System.Xml public override string Value { get { return null; } // always return null here. + [MonoTODO] + set { throw new NotImplementedException (); } } // Methods diff --git a/mcs/class/System.XML/System.Xml/XmlNode.cs b/mcs/class/System.XML/System.Xml/XmlNode.cs index 292a860a60f..4df1845b3a5 100644 --- a/mcs/class/System.XML/System.Xml/XmlNode.cs +++ b/mcs/class/System.XML/System.Xml/XmlNode.cs @@ -235,7 +235,7 @@ namespace System.Xml public abstract XmlNode CloneNode (bool deep); [MonoTODO] - public virtual XPathNavigator CreateNavigator () + public XPathNavigator CreateNavigator () { return new XmlDocumentNavigator(this); } diff --git a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs index a0779362129..c0958b8348d 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextWriter.cs @@ -18,28 +18,28 @@ namespace System.Xml { #region Fields - protected TextWriter w; - protected bool nullEncoding = false; - protected bool openWriter = true; - protected bool openStartElement = false; - protected bool openStartAttribute = false; - protected bool documentStarted = false; - private bool namespaces = true; - protected bool openAttribute = false; - protected bool attributeWrittenForElement = false; - protected Stack openElements = new Stack (); - private Formatting formatting = Formatting.None; - private int indentation = 2; - private char indentChar = ' '; - protected string indentChars = " "; - private char quoteChar = '\"'; - protected int indentLevel = 0; - protected string indentFormatting; - protected Stream baseStream = null; - protected string xmlLang = null; - protected XmlSpace xmlSpace = XmlSpace.None; - protected bool openXmlLang = false; - protected bool openXmlSpace = false; + TextWriter w; + bool nullEncoding = false; + bool openWriter = true; + bool openStartElement = false; + bool openStartAttribute = false; + bool documentStarted = false; + bool namespaces = true; + bool openAttribute = false; + bool attributeWrittenForElement = false; + Stack openElements = new Stack (); + Formatting formatting = Formatting.None; + int indentation = 2; + char indentChar = ' '; + string indentChars = " "; + char quoteChar = '\"'; + int indentLevel = 0; + string indentFormatting; + Stream baseStream = null; + string xmlLang = null; + XmlSpace xmlSpace = XmlSpace.None; + bool openXmlLang = false; + bool openXmlSpace = false; #endregion @@ -87,7 +87,7 @@ namespace System.Xml set { formatting = value; } } - public bool IndentingOverriden + private bool IndentingOverriden { get { if (openElements.Count == 0) @@ -515,7 +515,7 @@ namespace System.Xml WriteStartElementInternal (prefix, localName, ns); } - protected override void WriteStartElementInternal (string prefix, string localName, string ns) + private void WriteStartElementInternal (string prefix, string localName, string ns) { if (prefix == null) prefix = String.Empty; @@ -575,7 +575,7 @@ namespace System.Xml WriteStringInternal (text, true); } - public void WriteStringInternal (string text, bool entitize) + private void WriteStringInternal (string text, bool entitize) { if (text == null) text = String.Empty; diff --git a/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs new file mode 100644 index 00000000000..2c3faa56545 --- /dev/null +++ b/mcs/class/System.XML/System.Xml/XmlValidatingReader.cs @@ -0,0 +1,335 @@ +// +// System.Xml.XmlValidatingReader.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System.IO; +using System.Text; +using System.Xml.Schema; + +namespace System.Xml { + public class XmlValidatingReader : XmlReader, IXmlLineInfo { + + #region Fields + + EntityHandling entityHandling; + bool namespaces; + XmlReader reader; + ValidationType validationType; + + #endregion // Fields + + #region Constructors + + [MonoTODO] + public XmlValidatingReader (XmlReader reader) + : base () + { + if (!(reader is XmlTextReader)) + throw new ArgumentException (); + + this.reader = reader; + entityHandling = EntityHandling.ExpandEntities; + namespaces = true; + validationType = ValidationType.Auto; + } + + [MonoTODO] + public XmlValidatingReader (Stream xmlFragment, XmlNodeType fragType, XmlParserContext context) + : this (new XmlTextReader (xmlFragment)) + { + } + + public XmlValidatingReader (string xmlFragment, XmlNodeType fragType, XmlParserContext context) + : this (new XmlTextReader (xmlFragment)) + { + } + + #endregion // Constructors + + #region Properties + + public override int AttributeCount { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override string BaseURI { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override bool CanResolveEntity { + get { return true; } + } + + public override int Depth { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public Encoding Encoding { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public EntityHandling EntityHandling { + get { return entityHandling; } + set { entityHandling = value; } + } + + public override bool EOF { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override bool HasValue { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override bool IsDefault { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override bool IsEmptyElement { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override string this [int i] { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override string this [string name] { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override string this [string localName, string namespaceName] { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + int IXmlLineInfo.LineNumber { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + int IXmlLineInfo.LinePosition { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override string LocalName { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override string Name { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public bool Namespaces { + get { return namespaces; } + set { namespaces = value; } + } + + public override string NamespaceURI { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override XmlNameTable NameTable { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override XmlNodeType NodeType { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override string Prefix { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override char QuoteChar { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public XmlReader Reader { + get { return reader; } + } + + public override ReadState ReadState { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public XmlSchemaCollection Schemas { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public object SchemaType { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public ValidationType ValidationType { + get { return validationType; } + [MonoTODO ("Need to check for exception.")] + set { validationType = value; } + } + + public override string Value { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public override string XmlLang { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + XmlResolver XmlResolver { + [MonoTODO] + set { throw new NotImplementedException (); } + } + + public override XmlSpace XmlSpace { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public override void Close () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override string GetAttribute (int i) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override string GetAttribute (string name) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override string GetAttribute (string localName, string namespaceName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + bool IXmlLineInfo.HasLineInfo () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override string LookupNamespace (string prefix) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override void MoveToAttribute (int i) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool MoveToAttribute (string name) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool MoveToAttribute (string localName, string namespaceName) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool MoveToElement () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool MoveToFirstAttribute () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool MoveToNextAttribute () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool Read () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool ReadAttributeValue () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override string ReadInnerXml () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override string ReadOuterXml () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override string ReadString () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override void ResolveEntity () + { + throw new NotImplementedException (); + } + + #endregion // Methods + + #region Events and Delegates + + public event ValidationEventHandler ValidationEventHandler; + + #endregion // Events and Delegates + } +} diff --git a/mcs/class/System.XML/System.Xml/XmlWriter.cs b/mcs/class/System.XML/System.Xml/XmlWriter.cs index c383cca6501..4f95f200b2b 100644 --- a/mcs/class/System.XML/System.Xml/XmlWriter.cs +++ b/mcs/class/System.XML/System.Xml/XmlWriter.cs @@ -15,8 +15,8 @@ namespace System.Xml { #region Fields - protected WriteState ws = WriteState.Start; - protected XmlNamespaceManager namespaceManager = new XmlNamespaceManager (new NameTable ()); + private WriteState ws = WriteState.Start; + private XmlNamespaceManager namespaceManager = new XmlNamespaceManager (new NameTable ()); #endregion @@ -147,18 +147,16 @@ namespace System.Xml public void WriteStartElement (string localName) { - WriteStartElementInternal (null, localName, null); + WriteStartElement (String.Empty, localName, String.Empty); } public void WriteStartElement (string localName, string ns) { - WriteStartElement (null, localName, ns); + WriteStartElement (String.Empty, localName, ns); } public abstract void WriteStartElement (string prefix, string localName, string ns); - protected abstract void WriteStartElementInternal (string prefix, string localName, string ns); - public abstract void WriteString (string text); public abstract void WriteSurrogateCharEntity (char lowChar, char highChar); -- cgit v1.2.3