diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog index 97abfe91d7d3b..9a1523578d7a5 100755 --- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog @@ -1,3 +1,18 @@ +2002-07-24 Tim Coleman + * CodeIdentifier.cs: + * IXmlSerializable.cs: + * XmlSerializationCollectionFixupCallback.cs: + * XmlSerializationFixupCallback.cs: + * XmlSerializationReadCallback.cs: + * XmlSerializationReader.cs: + * XmlSerializationWriteCallback.cs: + Add new classes. + * XmlSchemas.cs + * CodeIdentifiers.cs: + Implement some of these classes + * XmlCodeExporter.cs: + Fix return type of a function + 2002-07-24 Tim Coleman * SoapReflectionImporter.cs: New class added to build diff --git a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs new file mode 100644 index 0000000000000..b7fecf5af2b7b --- /dev/null +++ b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifier.cs @@ -0,0 +1,50 @@ +// +// System.Xml.Serialization.CodeIdentifier.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System; + +namespace System.Xml.Serialization { + public class CodeIdentifier { + + public CodeIdentifier () + { + } + + public static string MakeCamel (string identifier) + { + string validIdentifier = MakeValid (identifier); + return (Char.ToLower (validIdentifier[0]) + validIdentifier.Substring (1)); + } + + public static string MakePascal (string identifier) + { + string validIdentifier = MakeValid (identifier); + return (Char.ToUpper (validIdentifier[0]) + validIdentifier.Substring (1)); + } + + public static string MakeValid (string identifier) + { + if (identifier == null) + throw new NullReferenceException (); + if (identifier.Length == 0) + return identifier; + + string output; + + if (Char.IsNumber (identifier[0])) + output = "Item"; + + foreach (char c in identifier) + if (Char.IsLetterOrDigit (c) || c == '_') + output += c; + + return output; + } + } +} diff --git a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs index 88dc221bcc7b6..a93a3805542cc 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/CodeIdentifiers.cs @@ -7,12 +7,16 @@ // Copyright (C) Tim Coleman, 2002 // +using System; +using System.Collections; + namespace System.Xml.Serialization { public class CodeIdentifiers { #region Fields bool useCamelCasing; + static Hashtable table = new Hashtable (); #endregion @@ -35,61 +39,65 @@ public CodeIdentifiers () #region Methods - [MonoTODO] public void Add (string identifier, object value) { - throw new NotImplementedException (); + table.Add (identifier, value); } - [MonoTODO] + [MonoTODO ("What does this do?")] public void AddReserved (string identifier) { throw new NotImplementedException (); } - [MonoTODO] public void AddUnique (string identifier, object value) { - throw new NotImplementedException (); + Add (MakeUnique (identifier), value); } - [MonoTODO] public void Clear () { - throw new NotImplementedException (); + table.Clear (); } - [MonoTODO] public bool IsInUse (string identifier) { - throw new NotImplementedException (); + return (table.ContainsKey (identifier)); } - [MonoTODO] public string MakeRightCase (string identifier) { - throw new NotImplementedException (); + if (UseCamelCasing) + return CodeIdentifier.MakeCamel (identifier); + else + return CodeIdentifier.MakePascal (identifier); } - [MonoTODO] public string MakeUnique (string identifier) { - throw new NotImplementedException (); + string uniqueIdentifier = identifier; + int i = 1; + + while (IsInUse (uniqueIdentifier)) { + uniqueIdentifier = String.Format ("{0}{1}", identifier, i.ToString ()); + i += 1; + } + + return uniqueIdentifier; } - [MonoTODO] public void Remove (string identifier) { - throw new NotImplementedException (); + table.Remove (identifier); } - [MonoTODO] + [MonoTODO ("What does this do?")] public void RemoveReserved (string identifier) { throw new NotImplementedException (); } - [MonoTODO] + [MonoTODO ("Need to determine how to do the conversion.")] public object ToArray (Type type) { throw new NotImplementedException (); diff --git a/mcs/class/System.XML/System.Xml.Serialization/IXmlSerializable.cs b/mcs/class/System.XML/System.Xml.Serialization/IXmlSerializable.cs new file mode 100644 index 0000000000000..3aa7f785e695d --- /dev/null +++ b/mcs/class/System.XML/System.Xml.Serialization/IXmlSerializable.cs @@ -0,0 +1,19 @@ +// +// System.Xml.Serialization.IXmlSerializable.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System.Xml.Schema; + +namespace System.Xml.Serialization { + public interface IXmlSerializable { + + XmlSchema GetSchema (); + void ReadXml (XmlReader reader); + void WriteXml (XmlWriter writer); + } +} diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs index 6124ebbaf8eda..d6ead00212f0c 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlCodeExporter.cs @@ -71,7 +71,7 @@ public void ExportMembersMapping (XmlMembersMapping xmlMembersMapping) } [MonoTODO] - public XmlQualifiedName ExportTypeMapping (XmlTypeMapping xmlTypeMapping) + public void ExportTypeMapping (XmlTypeMapping xmlTypeMapping) { throw new NotImplementedException (); } diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs index 2a65c41ba59e7..a6f79f6ccd130 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemas.cs @@ -15,7 +15,7 @@ public class XmlSchemas : CollectionBase { #region Fields - Hashtable table; + static Hashtable table = new Hashtable (); #endregion @@ -23,7 +23,6 @@ public class XmlSchemas : CollectionBase { public XmlSchemas () { - table = new Hashtable (); } #endregion // Constructors @@ -37,7 +36,7 @@ public XmlSchemas () return (XmlSchema) List [index]; } - set { throw new NotImplementedException (); } + set { List [index] = value; } } public XmlSchema this [string ns] { @@ -86,28 +85,24 @@ public static bool IsDataSet (XmlSchema schema) throw new NotImplementedException (); } - [MonoTODO] protected override void OnClear () { - throw new NotImplementedException (); + table.Clear (); } - [MonoTODO] protected override void OnInsert (int index, object value) - { - throw new NotImplementedException (); + { + table [((XmlSchema) value).TargetNamespace] = value; } - [MonoTODO] protected override void OnRemove (int index, object value) { - throw new NotImplementedException (); + table.Remove (value); } - [MonoTODO] protected override void OnSet (int index, object oldValue, object newValue) { - throw new NotImplementedException (); + table [((XmlSchema) oldValue).TargetNamespace] = newValue; } public void Remove (XmlSchema schema) diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationCollectionFixupCallback.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationCollectionFixupCallback.cs new file mode 100644 index 0000000000000..2fd79643126a5 --- /dev/null +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationCollectionFixupCallback.cs @@ -0,0 +1,17 @@ +// +// System.Xml.Serialization.XmlSerializationCollectionFixupCallback.cs: +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System; + +namespace System.Xml.Serialization { + + [Serializable] + public delegate void XmlSerializationCollectionFixupCallback (object collection, object collectionItems); +} + diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationFixupCallback.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationFixupCallback.cs new file mode 100644 index 0000000000000..e1bf47a4fa52e --- /dev/null +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationFixupCallback.cs @@ -0,0 +1,17 @@ +// +// System.Xml.Serialization.XmlSerializationFixupCallback.cs: +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System; + +namespace System.Xml.Serialization { + + [Serializable] + public delegate void XmlSerializationFixupCallback (object fixup); +} + diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReadCallback.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReadCallback.cs new file mode 100644 index 0000000000000..bd426ff0415b0 --- /dev/null +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReadCallback.cs @@ -0,0 +1,17 @@ +// +// System.Xml.Serialization.XmlSerializationReadCallback.cs: +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System; + +namespace System.Xml.Serialization { + + [Serializable] + public delegate object XmlSerializationReadCallback (); +} + diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs new file mode 100644 index 0000000000000..7d0e9f708eb29 --- /dev/null +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReader.cs @@ -0,0 +1,454 @@ +// +// System.Xml.Serialization.XmlSerializationReader.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System; +using System.Collections; +using System.Xml; + +namespace System.Xml.Serialization { + public abstract class XmlSerializationReader { + + #region Fields + + XmlDocument document; + XmlReader reader; + + #endregion + + [MonoTODO] + protected XmlSerializationReader () + { + throw new NotImplementedException (); + } + + protected XmlDocument Document { + get { return document; } + } + + protected XmlReader Reader { + get { return reader; } + } + + #region Methods + + [MonoTODO ("Implement")] + protected void AddFixup (XmlSerializationReader.CollectionFixup fixup) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void AddFixup (XmlSerializationReader.Fixup fixup) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void AddReadCallback (string name, string ns, Type type, XmlSerializationReadCallback read) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void AddTarget (string id, object o) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected Exception CreateAbstractTypeException (string name, string ns) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected Exception CreateInvalidCastException (string name, object value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected Exception CreateReadOnlyCollectionException (string name) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected Exception CreateUnknownConstantException (string value, Type enumType) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected Exception CreateUnknownNodeException () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected Exception CreateUnknownTypeException (XmlQualifiedName type) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected Array EnsureArrayIndex (Array a, int index, Type elementType) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void FixupArrayRefs (object fixup) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected int GetArrayLength (string name, string ns) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected bool GetNullAttr () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected object GetTarget (string id) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected XmlQualifiedName GetXsiType () + { + throw new NotImplementedException (); + } + + + protected abstract void InitCallbacks (); + protected abstract void InitIDs (); + + [MonoTODO ("Implement")] + protected bool IsXmlnsAttribute (string name) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void ParseWsdlArrayType (XmlAttribute attr) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected XmlQualifiedName ReadElementQualifiedName () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void ReadEndElement () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected bool ReadNull () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected XmlQualifiedName ReadNullableQualifiedName () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected string ReadNullableString () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected bool ReadReference (out string fixupReference) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected object ReadReferencedElement () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected object ReadReferencedElement (string name, string ns) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void ReadReferencedElements () + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected object ReadReferencingElement (out string fixupReference) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected object ReadReferencingElement (string name, string ns, out string fixupReference) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected object ReadReferencingElement (string name, string ns, bool elementCanBeType, out string fixupReference) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected IXmlSerializable ReadSerializable (IXmlSerializable serializable) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected string ReadString (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected object ReadTypedPrimitive (XmlQualifiedName type) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected XmlNode ReadXmlNode (bool wrapped) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void Referenced (object o) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected Array ShrinkArray (Array a, int length, Type elementType, bool isNullable) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected byte[] ToByteArrayBase64 (bool isNull) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static byte[] ToByteArrayBase64 (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected byte[] ToByteArrayHex (bool isNull) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static byte[] ToByteArrayHex (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static char ToChar (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static DateTime ToDate (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static DateTime ToDateTime (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static long ToEnum (string value, Hashtable h, string typeName) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static DateTime ToTime (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static string ToXmlName (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static string ToXmlNCName (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static string ToXmlNmToken (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected static string ToXmlNmTokens (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected XmlQualifiedName ToXmlQualifiedName (string value) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void UnknownAttribute (object o, XmlAttribute attr) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void UnknownElement (object o, XmlElement elem) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void UnknownNode (object o) + { + throw new NotImplementedException (); + } + + [MonoTODO ("Implement")] + protected void UnreferencedObject (string id, object o) + { + throw new NotImplementedException (); + } + + #endregion // Methods + + protected class CollectionFixup { + + #region Fields + + XmlSerializationCollectionFixupCallback callback; + object collection; + object collectionItems; + + #endregion // Fields + + #region Constructors + + [MonoTODO] + public CollectionFixup (object collection, XmlSerializationCollectionFixupCallback callback, object collectionItems) + { + this.callback = callback; + this.collection = collection; + this.collectionItems = collectionItems; + } + + #endregion // Constructors + + #region Properties + + public XmlSerializationCollectionFixupCallback Callback { + get { return callback; } + } + + public object Collection { + get { return collection; } + } + + public object CollectionItems { + get { return collectionItems; } + } + + #endregion // Properties + } + + protected class Fixup { + + #region Fields + + object source; + string[] ids; + XmlSerializationFixupCallback callback; + + #endregion // Fields + + #region Constructors + + [MonoTODO] + public Fixup (object o, XmlSerializationFixupCallback callback, int count) + { + this.callback = callback; + } + + [MonoTODO] + public Fixup (object o, XmlSerializationFixupCallback callback, string[] ids) + { + this.callback = callback; + } + + #endregion // Constructors + + #region Properties + + public XmlSerializationFixupCallback Callback { + get { return callback; } + } + + public string[] Ids { + get { return ids; } + } + + public object Source { + get { return source; } + set { source = value; } + } + + #endregion // Properties + } + } +} + diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriteCallback.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriteCallback.cs new file mode 100644 index 0000000000000..bc51126e2c7a8 --- /dev/null +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriteCallback.cs @@ -0,0 +1,17 @@ +// +// System.Xml.Serialization.XmlSerializationWriteCallback.cs: +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System; + +namespace System.Xml.Serialization { + + [Serializable] + public delegate object XmlSerializationWriteCallback (object o); +} +