2 // System.Xml.Serialization.XmlSerializationReader.cs
5 // Tim Coleman (tim@timcoleman.com)
6 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 // Lluis Sanchez Gual (lluis@ximian.com)
9 // Copyright (C) Tim Coleman, 2002
10 // (c) 2002 Ximian, Inc. (http://www.ximian.com)
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 using System.Collections;
36 using System.Globalization;
38 using System.Xml.Schema;
39 using System.Reflection;
41 namespace System.Xml.Serialization
44 // FIXME: provide expected elements/attributes on unknown elements/attributs
45 public abstract class XmlSerializationReader
46 : XmlSerializationGeneratedCode
55 ArrayList collItemFixups;
56 Hashtable typesCallbacks;
57 ArrayList noIDTargets;
59 Hashtable delayedListFixups;
60 XmlSerializer eventSource;
61 int delayedFixupId = 0;
62 Hashtable referencedObjects;
63 int readCount, whileIterationCount;
67 string w3InstanceNS2000;
68 string w3InstanceNS1999;
75 XmlQualifiedName arrayQName;
78 internal void Initialize (XmlReader reader, XmlSerializer eventSource)
80 w3SchemaNS = reader.NameTable.Add (XmlSchema.Namespace);
81 w3InstanceNS = reader.NameTable.Add (XmlSchema.InstanceNamespace);
82 w3InstanceNS2000 = reader.NameTable.Add ("http://www.w3.org/2000/10/XMLSchema-instance");
83 w3InstanceNS1999 = reader.NameTable.Add ("http://www.w3.org/1999/XMLSchema-instance");
84 soapNS = reader.NameTable.Add (XmlSerializer.EncodingNamespace);
85 wsdlNS = reader.NameTable.Add (XmlSerializer.WsdlNamespace);
86 nullX = reader.NameTable.Add ("null");
87 nil = reader.NameTable.Add ("nil");
88 typeX = reader.NameTable.Add ("type");
89 arrayType = reader.NameTable.Add ("arrayType");
91 this.eventSource = eventSource;
92 arrayQName = new XmlQualifiedName ("Array", soapNS);
96 private ArrayList EnsureArrayList (ArrayList list)
99 list = new ArrayList ();
103 private Hashtable EnsureHashtable (Hashtable hash)
106 hash = new Hashtable ();
110 protected XmlSerializationReader ()
114 protected XmlDocument Document
117 if (document == null)
118 document = new XmlDocument (reader.NameTable);
124 protected XmlReader Reader {
125 get { return reader; }
129 protected bool IsReturnValue
132 throw new NotImplementedException ();
135 throw new NotImplementedException ();
140 protected int ReaderCount {
141 get { return readCount; }
146 protected void AddFixup (CollectionFixup fixup)
148 collFixups = EnsureHashtable (collFixups);
149 collFixups [fixup.Id] = fixup;
151 if (delayedListFixups != null && delayedListFixups.ContainsKey (fixup.Id)) {
152 fixup.CollectionItems = delayedListFixups [fixup.Id];
153 delayedListFixups.Remove (fixup.Id);
157 protected void AddFixup (Fixup fixup)
159 fixups = EnsureArrayList (fixups);
163 void AddFixup (CollectionItemFixup fixup)
165 collItemFixups = EnsureArrayList (collItemFixups);
166 collItemFixups.Add(fixup);
169 protected void AddReadCallback (string name, string ns, Type type, XmlSerializationReadCallback read)
171 WriteCallbackInfo info = new WriteCallbackInfo ();
173 info.TypeName = name;
175 info.Callback = read;
176 typesCallbacks = EnsureHashtable (typesCallbacks);
177 typesCallbacks.Add (new XmlQualifiedName (name, ns), info);
180 protected void AddTarget (string id, object o)
183 targets = EnsureHashtable (targets);
184 if (targets [id] == null)
189 noIDTargets = EnsureArrayList (noIDTargets);
194 private string CurrentTag ()
196 switch (reader.NodeType) {
197 case XmlNodeType.Element:
198 return String.Format ("<{0} xmlns='{1}'>", reader.LocalName,
199 reader.NamespaceURI);
200 case XmlNodeType.Attribute:
202 case XmlNodeType.Text:
204 case XmlNodeType.ProcessingInstruction:
206 case XmlNodeType.Entity:
208 case XmlNodeType.EndElement:
215 protected Exception CreateCtorHasSecurityException (string typeName)
217 string message = string.Format ("The type '{0}' cannot"
218 + " be serialized because its parameterless"
219 + " constructor is decorated with declarative"
220 + " security permission attributes."
221 + " Consider using imperative asserts or demands"
222 + " in the constructor.", typeName);
223 return new InvalidOperationException (message);
226 protected Exception CreateInaccessibleConstructorException (string typeName)
228 string message = string.Format ("{0} cannot be serialized"
229 + " because it does not have a default public"
230 + " constructor.", typeName);
231 return new InvalidOperationException (message);
234 protected Exception CreateAbstractTypeException (string name, string ns)
236 string message = "The specified type is abstrace: name='" + name + "' namespace='" + ns + "', at " + CurrentTag ();
237 return new InvalidOperationException (message);
240 protected Exception CreateInvalidCastException (Type type, object value)
242 string message = String.Format (CultureInfo.InvariantCulture, "Cannot assign object of type {0} to an object of " +
243 "type {1}.", value.GetType (), type);
244 return new InvalidCastException (message);
247 protected Exception CreateReadOnlyCollectionException (string name)
249 string message = String.Format ("Could not serialize {0}. Default constructors are " +
250 "required for collections and enumerators.", name);
251 return new InvalidOperationException (message);
254 protected Exception CreateUnknownConstantException (string value, Type enumType)
256 string message = String.Format ("'{0}' is not a valid value for {1}.", value, enumType);
257 return new InvalidOperationException (message);
260 protected Exception CreateUnknownNodeException ()
262 string message = CurrentTag () + " was not expected";
263 return new InvalidOperationException (message);
266 protected Exception CreateUnknownTypeException (XmlQualifiedName type)
268 string message = "The specified type was not recognized: name='" + type.Name + "' namespace='" + type.Namespace + "', at " + CurrentTag ();
269 return new InvalidOperationException (message);
272 protected void CheckReaderCount (ref int whileIterations, ref int readerCount)
274 whileIterations = whileIterationCount;
275 readerCount = readCount;
278 protected Array EnsureArrayIndex (Array a, int index, Type elementType)
280 if (a != null && index < a.Length)
290 Array result = Array.CreateInstance (elementType, size);
292 Array.Copy (a, result, index);
298 protected void FixupArrayRefs (object fixup)
300 throw new NotImplementedException ();
304 protected int GetArrayLength (string name, string ns)
306 throw new NotImplementedException ();
309 protected bool GetNullAttr ()
311 string na = reader.GetAttribute (nullX, w3InstanceNS);
313 na = reader.GetAttribute (nil, w3InstanceNS);
315 na = reader.GetAttribute (nullX, w3InstanceNS2000);
317 na = reader.GetAttribute (nullX, w3InstanceNS1999);
323 protected object GetTarget (string id)
325 if (targets == null) return null;
326 object ob = targets [id];
328 if (referencedObjects == null) referencedObjects = new Hashtable ();
329 referencedObjects [ob] = ob;
334 bool TargetReady (string id)
336 if (targets == null) return false;
337 return targets.ContainsKey (id);
340 protected XmlQualifiedName GetXsiType ()
342 string typeName = Reader.GetAttribute (typeX, XmlSchema.InstanceNamespace);
344 if (typeName == string.Empty || typeName == null) {
345 typeName = Reader.GetAttribute (typeX, w3InstanceNS1999);
346 if (typeName == string.Empty || typeName == null) {
347 typeName = Reader.GetAttribute (typeX, w3InstanceNS2000);
348 if (typeName == string.Empty || typeName == null)
353 int i = typeName.IndexOf (":");
354 if (i == -1) return new XmlQualifiedName (typeName, Reader.NamespaceURI);
357 string prefix = typeName.Substring(0,i);
358 string name = typeName.Substring (i+1);
359 return new XmlQualifiedName (name, Reader.LookupNamespace (prefix));
363 protected abstract void InitCallbacks ();
364 protected abstract void InitIDs ();
366 protected bool IsXmlnsAttribute (string name)
368 int length = name.Length;
373 return (name == "xmlns");
375 return name.StartsWith ("xmlns:");
378 protected void ParseWsdlArrayType (XmlAttribute attr)
380 if (attr.NamespaceURI == wsdlNS && attr.LocalName == arrayType)
382 string ns = "", type, dimensions;
383 TypeTranslator.ParseArrayType (attr.Value, out type, out ns, out dimensions);
384 if (ns != "") ns = Reader.LookupNamespace (ns) + ":";
385 attr.Value = ns + type + dimensions;
389 protected XmlQualifiedName ReadElementQualifiedName ()
393 if (reader.IsEmptyElement) {
395 return ToXmlQualifiedName (String.Empty);
398 reader.ReadStartElement ();
399 XmlQualifiedName xqn = ToXmlQualifiedName(reader.ReadString ());
400 reader.ReadEndElement ();
404 protected void ReadEndElement ()
408 while (reader.NodeType == XmlNodeType.Whitespace)
411 if (reader.NodeType != XmlNodeType.None) {
412 reader.ReadEndElement ();
418 protected bool ReadNull ()
425 if (reader.IsEmptyElement) {
430 reader.ReadStartElement();
431 while (reader.NodeType != XmlNodeType.EndElement)
438 protected XmlQualifiedName ReadNullableQualifiedName ()
443 return ReadElementQualifiedName ();
446 protected string ReadNullableString ()
452 return reader.ReadElementString ();
455 protected bool ReadReference (out string fixupReference)
457 string href = reader.GetAttribute ("href");
459 fixupReference = null;
464 throw new InvalidOperationException("href not found: " + href);
466 fixupReference = href.Substring (1);
468 if (!reader.IsEmptyElement) {
469 reader.ReadStartElement ();
477 protected object ReadReferencedElement ()
479 return ReadReferencedElement (Reader.LocalName, Reader.NamespaceURI);
482 WriteCallbackInfo GetCallbackInfo (XmlQualifiedName qname)
484 if (typesCallbacks == null)
486 typesCallbacks = new Hashtable ();
489 return (WriteCallbackInfo) typesCallbacks[qname];
492 protected object ReadReferencedElement (string name, string ns)
494 XmlQualifiedName qname = GetXsiType ();
495 if (qname == null) qname = new XmlQualifiedName (name, ns);
497 string id = Reader.GetAttribute ("id");
500 // it takes precedence over xsi:type.
501 // Sometimes there are array types in WSDL,
502 // which are not reflected in client proxies.
503 // In SOAP messages, they are marked
504 // soap-env:arrayType, so use it (this could coexist
505 // with xsi:type, which indicates the type in WSDL).
507 string arrayTypeVal = Reader.GetAttribute (arrayType, soapNS);
509 if (qname == arrayQName || arrayTypeVal != null && arrayTypeVal.Length > 0)
511 CollectionFixup fixup = (collFixups != null) ? (CollectionFixup) collFixups[id] : null;
512 if (ReadList (out ob))
514 // List complete (does not contain references)
517 fixup.Callback (fixup.Collection, ob);
518 collFixups.Remove (id);
519 ob = fixup.Collection;
522 else if (fixup != null)
524 fixup.CollectionItems = (object[])ob;
525 ob = fixup.Collection;
530 WriteCallbackInfo info = GetCallbackInfo (qname);
532 ob = ReadTypedPrimitive (qname, id != null);
534 ob = info.Callback();
540 bool ReadList (out object resultList)
542 string arrayTypeAttr = Reader.GetAttribute (arrayType, soapNS);
543 if (arrayTypeAttr == null) arrayTypeAttr = Reader.GetAttribute (arrayType, wsdlNS);
545 XmlQualifiedName qn = ToXmlQualifiedName (arrayTypeAttr);
546 int i = qn.Name.LastIndexOf ('[');
547 string dim = qn.Name.Substring (i);
548 string itemType = qn.Name.Substring (0,i);
549 int count = Int32.Parse (dim.Substring (1, dim.Length - 2), CultureInfo.InvariantCulture);
553 i = itemType.IndexOf ('['); if (i == -1) i = itemType.Length;
554 string baseType = itemType.Substring (0,i);
555 string arrayTypeName;
557 if (qn.Namespace == w3SchemaNS)
558 arrayTypeName = TypeTranslator.GetPrimitiveTypeData (baseType).Type.FullName + itemType.Substring (i);
561 WriteCallbackInfo info = GetCallbackInfo (new XmlQualifiedName (baseType,qn.Namespace));
562 arrayTypeName = info.Type.FullName + itemType.Substring (i) + ", " + info.Type.Assembly.FullName;
565 list = Array.CreateInstance (Type.GetType (arrayTypeName), count);
567 bool listComplete = true;
569 if (Reader.IsEmptyElement) {
573 Reader.ReadStartElement ();
574 for (int n=0; n<count; n++)
576 whileIterationCount++;
578 Reader.MoveToContent ();
580 object item = ReadReferencingElement (itemType, qn.Namespace, out id);
582 list.SetValue (item,n);
585 AddFixup (new CollectionItemFixup (list, n, id));
586 listComplete = false;
589 whileIterationCount = 0;
590 Reader.ReadEndElement ();
597 protected void ReadReferencedElements ()
599 reader.MoveToContent();
600 XmlNodeType nt = reader.NodeType;
601 while (nt != XmlNodeType.EndElement && nt != XmlNodeType.None) {
602 whileIterationCount++;
604 ReadReferencedElement ();
605 reader.MoveToContent ();
606 nt = reader.NodeType;
608 whileIterationCount = 0;
610 // Registers delayed list
612 if (delayedListFixups != null)
614 foreach (DictionaryEntry entry in delayedListFixups)
615 AddTarget ((string)entry.Key, entry.Value);
619 if (collItemFixups != null)
621 foreach (CollectionItemFixup itemFixup in collItemFixups)
622 itemFixup.Collection.SetValue (GetTarget (itemFixup.Id), itemFixup.Index);
627 if (collFixups != null)
629 ICollection cfixups = collFixups.Values;
630 foreach (CollectionFixup fixup in cfixups)
631 fixup.Callback (fixup.Collection, fixup.CollectionItems);
634 // Fills class instances
638 foreach (Fixup fixup in fixups)
639 fixup.Callback (fixup);
642 if (targets != null) {
643 foreach (DictionaryEntry e in targets) {
644 if (e.Value != null && (referencedObjects == null || !referencedObjects.Contains (e.Value)))
645 UnreferencedObject ((string)e.Key, e.Value);
650 protected object ReadReferencingElement (out string fixupReference)
652 return ReadReferencingElement (Reader.LocalName, Reader.NamespaceURI, false, out fixupReference);
655 protected object ReadReferencingElement (string name, string ns, out string fixupReference)
657 return ReadReferencingElement (name, ns, false, out fixupReference);
660 protected object ReadReferencingElement (string name,
662 bool elementCanBeType,
663 out string fixupReference)
667 fixupReference = null;
671 string refid = Reader.GetAttribute ("href");
673 if (refid == string.Empty || refid == null)
675 fixupReference = null;
677 XmlQualifiedName qname = GetXsiType ();
678 if (qname == null) qname = new XmlQualifiedName (name, ns);
679 string arrayTypeAttr = Reader.GetAttribute (arrayType, soapNS);
681 if (qname == arrayQName || arrayTypeAttr != null)
683 delayedListFixups = EnsureHashtable (delayedListFixups);
684 fixupReference = "__<" + (delayedFixupId++) + ">";
686 ReadList (out items);
687 delayedListFixups [fixupReference] = items;
692 WriteCallbackInfo info = GetCallbackInfo (qname);
694 return ReadTypedPrimitive (qname, true);
696 return info.Callback();
701 if (refid.StartsWith ("#")) refid = refid.Substring (1);
705 if (TargetReady (refid))
707 fixupReference = null;
708 return GetTarget (refid);
712 fixupReference = refid;
718 protected IXmlSerializable ReadSerializable (IXmlSerializable serializable)
720 if (ReadNull ()) return null;
721 int depth = reader.Depth;
723 serializable.ReadXml (reader);
724 Reader.MoveToContent ();
725 while (reader.Depth > depth)
727 if (reader.Depth == depth && reader.NodeType == XmlNodeType.EndElement)
728 reader.ReadEndElement ();
732 protected string ReadString (string value)
735 if (value == null || value == String.Empty)
736 return reader.ReadString ();
738 return (value + reader.ReadString ());
741 protected object ReadTypedPrimitive (XmlQualifiedName type)
743 return ReadTypedPrimitive (type, false);
746 object ReadTypedPrimitive (XmlQualifiedName qname, bool reportUnknown)
748 if (qname == null) qname = GetXsiType ();
750 TypeData typeData = TypeTranslator.FindPrimitiveTypeData (qname.Name);
751 if (typeData == null || typeData.SchemaType != SchemaTypes.Primitive)
753 // Put everything into a node array
755 XmlNode node = Document.ReadNode (reader);
758 OnUnknownNode (node, null, null);
760 if (node.ChildNodes.Count == 0 && node.Attributes.Count == 0)
761 return new Object ();
763 XmlElement elem = node as XmlElement;
766 return new XmlNode[] {node};
768 XmlNode[] nodes = new XmlNode[elem.Attributes.Count + elem.ChildNodes.Count];
770 foreach (XmlNode no in elem.Attributes)
772 foreach (XmlNode no in elem.ChildNodes)
778 if (typeData.Type == typeof (XmlQualifiedName)) return ReadNullableQualifiedName ();
780 return XmlCustomFormatter.FromXmlString (typeData, Reader.ReadElementString ());
783 protected XmlNode ReadXmlNode (bool wrapped)
786 XmlNode node = Document.ReadNode (reader);
788 return node.FirstChild;
793 protected XmlDocument ReadXmlDocument (bool wrapped)
798 reader.ReadStartElement ();
799 reader.MoveToContent ();
800 XmlDocument doc = new XmlDocument (reader.NameTable);
801 XmlNode node = doc.ReadNode (reader);
802 doc.AppendChild (node);
805 reader.ReadEndElement ();
810 protected void Referenced (object o)
813 if (referencedObjects == null) referencedObjects = new Hashtable ();
814 referencedObjects [o] = o;
818 protected Array ShrinkArray (Array a, int length, Type elementType, bool isNullable)
820 if (length == 0 && isNullable) return null;
821 if (a == null) return Array.CreateInstance (elementType, length);
822 if (a.Length == length) return a;
824 Array result = Array.CreateInstance (elementType, length);
825 Array.Copy (a, result, length);
829 protected byte[] ToByteArrayBase64 (bool isNull)
833 Reader.ReadString ();
837 return ToByteArrayBase64 (Reader.ReadString ());
840 protected static byte[] ToByteArrayBase64 (string value)
842 return Convert.FromBase64String (value);
845 protected byte[] ToByteArrayHex (bool isNull)
849 Reader.ReadString ();
853 return ToByteArrayHex (Reader.ReadString ());
856 protected static byte[] ToByteArrayHex (string value)
858 return XmlConvert.FromBinHexString (value);
861 protected static char ToChar (string value)
863 return XmlCustomFormatter.ToChar (value);
866 protected static DateTime ToDate (string value)
868 return XmlCustomFormatter.ToDate (value);
871 protected static DateTime ToDateTime (string value)
873 return XmlCustomFormatter.ToDateTime (value);
876 protected static long ToEnum (string value, Hashtable h, string typeName)
878 return XmlCustomFormatter.ToEnum (value, h, typeName, true);
881 protected static DateTime ToTime (string value)
883 return XmlCustomFormatter.ToTime (value);
886 protected static string ToXmlName (string value)
888 return XmlCustomFormatter.ToXmlName (value);
891 protected static string ToXmlNCName (string value)
893 return XmlCustomFormatter.ToXmlNCName (value);
896 protected static string ToXmlNmToken (string value)
898 return XmlCustomFormatter.ToXmlNmToken (value);
901 protected static string ToXmlNmTokens (string value)
903 return XmlCustomFormatter.ToXmlNmTokens (value);
906 protected XmlQualifiedName ToXmlQualifiedName (string value)
910 int lastColon = value.LastIndexOf (':');
911 string decodedValue = XmlConvert.DecodeName (value);
913 name = reader.NameTable.Add (decodedValue);
914 ns = reader.LookupNamespace (String.Empty);
916 string prefix = value.Substring (0, lastColon);
917 ns = reader.LookupNamespace (prefix);
919 throw new InvalidOperationException ("namespace " + prefix + " not defined");
921 name = reader.NameTable.Add (value.Substring (lastColon + 1));
924 return new XmlQualifiedName (name, ns);
927 protected void UnknownAttribute (object o, XmlAttribute attr)
929 UnknownAttribute (o, attr, null);
933 void UnknownAttribute (object o, XmlAttribute attr, string qnames)
935 int line_number, line_position;
937 if (Reader is XmlTextReader){
938 line_number = ((XmlTextReader)Reader).LineNumber;
939 line_position = ((XmlTextReader)Reader).LinePosition;
945 XmlAttributeEventArgs args = new XmlAttributeEventArgs (attr, line_number, line_position, o, qnames);
947 if (eventSource != null)
948 eventSource.OnUnknownAttribute (args);
951 protected void UnknownElement (object o, XmlElement elem)
953 UnknownElement (o, elem, null);
957 void UnknownElement (object o, XmlElement elem, string qnames)
959 int line_number, line_position;
961 if (Reader is XmlTextReader){
962 line_number = ((XmlTextReader)Reader).LineNumber;
963 line_position = ((XmlTextReader)Reader).LinePosition;
969 XmlElementEventArgs args = new XmlElementEventArgs (elem, line_number, line_position, o, qnames);
971 if (eventSource != null)
972 eventSource.OnUnknownElement (args);
975 protected void UnknownNode (object o)
977 UnknownNode (o, null);
981 void UnknownNode (object o, string qnames)
983 OnUnknownNode (ReadXmlNode (false), o, qnames);
986 void OnUnknownNode (XmlNode node, object o, string qnames)
988 int line_number, line_position;
990 if (Reader is XmlTextReader){
991 line_number = ((XmlTextReader)Reader).LineNumber;
992 line_position = ((XmlTextReader)Reader).LinePosition;
998 if (node is XmlAttribute)
1000 UnknownAttribute (o, (XmlAttribute)node, qnames);
1003 else if (node is XmlElement)
1005 UnknownElement (o, (XmlElement) node, qnames);
1010 if (eventSource != null)
1011 eventSource.OnUnknownNode (new XmlNodeEventArgs(node, line_number, line_position, o));
1013 if (Reader.ReadState == ReadState.EndOfFile)
1014 throw new InvalidOperationException ("End of document found");
1018 protected void UnreferencedObject (string id, object o)
1020 if (eventSource != null)
1021 eventSource.OnUnreferencedObject (new UnreferencedObjectEventArgs (o,id));
1024 #endregion // Methods
1026 class WriteCallbackInfo
1029 public string TypeName;
1030 public string TypeNs;
1031 public XmlSerializationReadCallback Callback;
1034 protected class CollectionFixup {
1036 XmlSerializationCollectionFixupCallback callback;
1038 object collectionItems;
1041 public CollectionFixup(object collection, XmlSerializationCollectionFixupCallback callback, object collectionItems)
1043 this.callback = callback;
1044 this.collection = collection;
1045 this.collectionItems = collectionItems;
1048 internal CollectionFixup (object collection, XmlSerializationCollectionFixupCallback callback, string id)
1050 this.callback = callback;
1051 this.collection = collection;
1055 public XmlSerializationCollectionFixupCallback Callback {
1056 get { return callback; }
1059 public object Collection {
1060 get { return collection; }
1063 internal object Id {
1067 public object CollectionItems
1069 get { return collectionItems; }
1070 internal set { collectionItems = value; }
1074 protected class Fixup {
1078 XmlSerializationFixupCallback callback;
1080 public Fixup (object o, XmlSerializationFixupCallback callback, int count)
1083 this.callback = callback;
1084 this.ids = new string[count];
1087 public Fixup (object o, XmlSerializationFixupCallback callback, string[] ids)
1091 this.callback = callback;
1094 public XmlSerializationFixupCallback Callback {
1095 get { return callback; }
1098 public string[] Ids {
1102 public object Source {
1103 get { return source; }
1104 set { source = value; }
1108 class CollectionItemFixup
1114 public CollectionItemFixup (Array list, int index, string id)
1121 public Array Collection
1123 get { return list; }
1128 get { return index; }
1138 protected bool DecodeName
1140 get { throw new NotImplementedException(); }
1141 set { throw new NotImplementedException(); }
1144 protected string CollapseWhitespace (string value)
1146 return value == null ? null : value.Trim ();
1150 protected Exception CreateBadDerivationException (
1158 throw new NotImplementedException ();
1162 protected Exception CreateInvalidCastException (Type type, object value, string id)
1164 throw new NotImplementedException ();
1168 protected Exception CreateMissingIXmlSerializableType (string name, string ns, string clrType)
1170 throw new NotImplementedException ();
1174 protected string ReadString (string value, bool trim)
1176 throw new NotImplementedException ();
1180 protected object ReadTypedNull (XmlQualifiedName type)
1182 throw new NotImplementedException ();
1186 protected static Assembly ResolveDynamicAssembly (string assemblyFullName)
1188 throw new NotImplementedException ();