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
45 // FIXME: provide expected elements/attributes on unknown elements/attributs
47 public abstract class XmlSerializationReader
49 : XmlSerializationGeneratedCode
61 ArrayList collItemFixups;
62 Hashtable typesCallbacks;
63 ArrayList noIDTargets;
65 Hashtable delayedListFixups;
66 XmlSerializer eventSource;
67 int delayedFixupId = 0;
68 Hashtable referencedObjects;
69 int readCount, whileIterationCount;
73 string w3InstanceNS2000;
74 string w3InstanceNS1999;
81 XmlQualifiedName arrayQName;
84 internal void Initialize (XmlReader reader, XmlSerializer eventSource)
86 w3SchemaNS = reader.NameTable.Add (XmlSchema.Namespace);
87 w3InstanceNS = reader.NameTable.Add (XmlSchema.InstanceNamespace);
88 w3InstanceNS2000 = reader.NameTable.Add ("http://www.w3.org/2000/10/XMLSchema-instance");
89 w3InstanceNS1999 = reader.NameTable.Add ("http://www.w3.org/1999/XMLSchema-instance");
90 soapNS = reader.NameTable.Add (XmlSerializer.EncodingNamespace);
91 wsdlNS = reader.NameTable.Add (XmlSerializer.WsdlNamespace);
92 nullX = reader.NameTable.Add ("null");
93 nil = reader.NameTable.Add ("nil");
94 typeX = reader.NameTable.Add ("type");
95 arrayType = reader.NameTable.Add ("arrayType");
97 this.eventSource = eventSource;
98 arrayQName = new XmlQualifiedName ("Array", soapNS);
102 private ArrayList EnsureArrayList (ArrayList list)
105 list = new ArrayList ();
109 private Hashtable EnsureHashtable (Hashtable hash)
112 hash = new Hashtable ();
116 protected XmlSerializationReader ()
121 protected XmlDocument Document
124 if (document == null)
125 document = new XmlDocument (reader.NameTable);
132 protected XmlReader Reader {
133 get { return reader; }
137 protected bool IsReturnValue
140 throw new NotImplementedException ();
143 throw new NotImplementedException ();
149 protected int ReaderCount {
150 get { return readCount; }
156 protected void AddFixup (CollectionFixup fixup)
158 collFixups = EnsureHashtable (collFixups);
159 collFixups [fixup.Id] = fixup;
161 if (delayedListFixups != null && delayedListFixups.ContainsKey (fixup.Id)) {
162 fixup.CollectionItems = delayedListFixups [fixup.Id];
163 delayedListFixups.Remove (fixup.Id);
167 protected void AddFixup (Fixup fixup)
169 fixups = EnsureArrayList (fixups);
173 void AddFixup (CollectionItemFixup fixup)
175 collItemFixups = EnsureArrayList (collItemFixups);
176 collItemFixups.Add(fixup);
179 protected void AddReadCallback (string name, string ns, Type type, XmlSerializationReadCallback read)
181 WriteCallbackInfo info = new WriteCallbackInfo ();
183 info.TypeName = name;
185 info.Callback = read;
186 typesCallbacks = EnsureHashtable (typesCallbacks);
187 typesCallbacks.Add (new XmlQualifiedName (name, ns), info);
190 protected void AddTarget (string id, object o)
193 targets = EnsureHashtable (targets);
194 if (targets [id] == null)
199 noIDTargets = EnsureArrayList (noIDTargets);
204 private string CurrentTag ()
206 switch (reader.NodeType) {
207 case XmlNodeType.Element:
208 return String.Format ("<{0} xmlns='{1}'>", reader.LocalName,
209 reader.NamespaceURI);
210 case XmlNodeType.Attribute:
212 case XmlNodeType.Text:
214 case XmlNodeType.ProcessingInstruction:
216 case XmlNodeType.Entity:
218 case XmlNodeType.EndElement:
225 protected Exception CreateCtorHasSecurityException (string typeName)
227 string message = string.Format ("The type '{0}' cannot"
228 + " be serialized because its parameterless"
229 + " constructor is decorated with declarative"
230 + " security permission attributes."
231 + " Consider using imperative asserts or demands"
232 + " in the constructor.", typeName);
233 return new InvalidOperationException (message);
236 protected Exception CreateInaccessibleConstructorException (string typeName)
238 string message = string.Format ("{0} cannot be serialized"
239 + " because it does not have a default public"
240 + " constructor.", typeName);
241 return new InvalidOperationException (message);
244 protected Exception CreateAbstractTypeException (string name, string ns)
246 string message = "The specified type is abstrace: name='" + name + "' namespace='" + ns + "', at " + CurrentTag ();
247 return new InvalidOperationException (message);
250 protected Exception CreateInvalidCastException (Type type, object value)
252 string message = String.Format (CultureInfo.InvariantCulture, "Cannot assign object of type {0} to an object of " +
253 "type {1}.", value.GetType (), type);
254 return new InvalidCastException (message);
257 protected Exception CreateReadOnlyCollectionException (string name)
259 string message = String.Format ("Could not serialize {0}. Default constructors are " +
260 "required for collections and enumerators.", name);
261 return new InvalidOperationException (message);
264 protected Exception CreateUnknownConstantException (string value, Type enumType)
266 string message = String.Format ("'{0}' is not a valid value for {1}.", value, enumType);
267 return new InvalidOperationException (message);
270 protected Exception CreateUnknownNodeException ()
272 string message = CurrentTag () + " was not expected";
273 return new InvalidOperationException (message);
276 protected Exception CreateUnknownTypeException (XmlQualifiedName type)
278 string message = "The specified type was not recognized: name='" + type.Name + "' namespace='" + type.Namespace + "', at " + CurrentTag ();
279 return new InvalidOperationException (message);
283 protected void CheckReaderCount (ref int whileIterations, ref int readerCount)
285 whileIterations = whileIterationCount;
286 readerCount = readCount;
290 protected Array EnsureArrayIndex (Array a, int index, Type elementType)
292 if (a != null && index < a.Length)
302 Array result = Array.CreateInstance (elementType, size);
304 Array.Copy (a, result, index);
310 protected void FixupArrayRefs (object fixup)
312 throw new NotImplementedException ();
316 protected int GetArrayLength (string name, string ns)
318 throw new NotImplementedException ();
321 protected bool GetNullAttr ()
323 string na = reader.GetAttribute (nullX, w3InstanceNS);
325 na = reader.GetAttribute (nil, w3InstanceNS);
327 na = reader.GetAttribute (nullX, w3InstanceNS2000);
329 na = reader.GetAttribute (nullX, w3InstanceNS1999);
335 protected object GetTarget (string id)
337 if (targets == null) return null;
338 object ob = targets [id];
340 if (referencedObjects == null) referencedObjects = new Hashtable ();
341 referencedObjects [ob] = ob;
346 bool TargetReady (string id)
348 if (targets == null) return false;
349 return targets.ContainsKey (id);
352 protected XmlQualifiedName GetXsiType ()
354 string typeName = Reader.GetAttribute (typeX, XmlSchema.InstanceNamespace);
356 if (typeName == string.Empty || typeName == null) {
357 typeName = Reader.GetAttribute (typeX, w3InstanceNS1999);
358 if (typeName == string.Empty || typeName == null) {
359 typeName = Reader.GetAttribute (typeX, w3InstanceNS2000);
360 if (typeName == string.Empty || typeName == null)
365 int i = typeName.IndexOf (":");
366 if (i == -1) return new XmlQualifiedName (typeName, Reader.NamespaceURI);
369 string prefix = typeName.Substring(0,i);
370 string name = typeName.Substring (i+1);
371 return new XmlQualifiedName (name, Reader.LookupNamespace (prefix));
375 protected abstract void InitCallbacks ();
376 protected abstract void InitIDs ();
378 protected bool IsXmlnsAttribute (string name)
380 int length = name.Length;
385 return (name == "xmlns");
387 return name.StartsWith ("xmlns:");
391 protected void ParseWsdlArrayType (XmlAttribute attr)
393 if (attr.NamespaceURI == wsdlNS && attr.LocalName == arrayType)
395 string ns = "", type, dimensions;
396 TypeTranslator.ParseArrayType (attr.Value, out type, out ns, out dimensions);
397 if (ns != "") ns = Reader.LookupNamespace (ns) + ":";
398 attr.Value = ns + type + dimensions;
403 protected XmlQualifiedName ReadElementQualifiedName ()
407 if (reader.IsEmptyElement) {
409 return ToXmlQualifiedName (String.Empty);
412 reader.ReadStartElement ();
413 XmlQualifiedName xqn = ToXmlQualifiedName(reader.ReadString ());
414 reader.ReadEndElement ();
418 protected void ReadEndElement ()
422 while (reader.NodeType == XmlNodeType.Whitespace)
425 if (reader.NodeType != XmlNodeType.None) {
426 reader.ReadEndElement ();
432 protected bool ReadNull ()
439 if (reader.IsEmptyElement) {
444 reader.ReadStartElement();
446 while (reader.NodeType != XmlNodeType.EndElement)
449 while (reader.NodeType != XmlNodeType.EndElement)
457 protected XmlQualifiedName ReadNullableQualifiedName ()
462 return ReadElementQualifiedName ();
465 protected string ReadNullableString ()
471 return reader.ReadElementString ();
474 protected bool ReadReference (out string fixupReference)
476 string href = reader.GetAttribute ("href");
478 fixupReference = null;
483 throw new InvalidOperationException("href not found: " + href);
485 fixupReference = href.Substring (1);
487 if (!reader.IsEmptyElement) {
488 reader.ReadStartElement ();
496 protected object ReadReferencedElement ()
498 return ReadReferencedElement (Reader.LocalName, Reader.NamespaceURI);
501 WriteCallbackInfo GetCallbackInfo (XmlQualifiedName qname)
503 if (typesCallbacks == null)
505 typesCallbacks = new Hashtable ();
508 return (WriteCallbackInfo) typesCallbacks[qname];
511 protected object ReadReferencedElement (string name, string ns)
513 XmlQualifiedName qname = GetXsiType ();
514 if (qname == null) qname = new XmlQualifiedName (name, ns);
516 string id = Reader.GetAttribute ("id");
519 // it takes precedence over xsi:type.
520 // Sometimes there are array types in WSDL,
521 // which are not reflected in client proxies.
522 // In SOAP messages, they are marked
523 // soap-env:arrayType, so use it (this could coexist
524 // with xsi:type, which indicates the type in WSDL).
526 string arrayTypeVal = Reader.GetAttribute (arrayType, soapNS);
528 if (qname == arrayQName || arrayTypeVal != null && arrayTypeVal.Length > 0)
530 CollectionFixup fixup = (collFixups != null) ? (CollectionFixup) collFixups[id] : null;
531 if (ReadList (out ob))
533 // List complete (does not contain references)
536 fixup.Callback (fixup.Collection, ob);
537 collFixups.Remove (id);
538 ob = fixup.Collection;
541 else if (fixup != null)
543 fixup.CollectionItems = (object[])ob;
544 ob = fixup.Collection;
549 WriteCallbackInfo info = GetCallbackInfo (qname);
551 ob = ReadTypedPrimitive (qname, id != null);
553 ob = info.Callback();
559 bool ReadList (out object resultList)
561 string arrayTypeAttr = Reader.GetAttribute (arrayType, soapNS);
562 if (arrayTypeAttr == null) arrayTypeAttr = Reader.GetAttribute (arrayType, wsdlNS);
564 XmlQualifiedName qn = ToXmlQualifiedName (arrayTypeAttr);
565 int i = qn.Name.LastIndexOf ('[');
566 string dim = qn.Name.Substring (i);
567 string itemType = qn.Name.Substring (0,i);
568 int count = Int32.Parse (dim.Substring (1, dim.Length - 2), CultureInfo.InvariantCulture);
572 i = itemType.IndexOf ('['); if (i == -1) i = itemType.Length;
573 string baseType = itemType.Substring (0,i);
574 string arrayTypeName;
576 if (qn.Namespace == w3SchemaNS)
577 arrayTypeName = TypeTranslator.GetPrimitiveTypeData (baseType).Type.FullName + itemType.Substring (i);
580 WriteCallbackInfo info = GetCallbackInfo (new XmlQualifiedName (baseType,qn.Namespace));
581 arrayTypeName = info.Type.FullName + itemType.Substring (i) + ", " + info.Type.Assembly.FullName;
584 list = Array.CreateInstance (Type.GetType (arrayTypeName), count);
586 bool listComplete = true;
588 if (Reader.IsEmptyElement) {
592 Reader.ReadStartElement ();
593 for (int n=0; n<count; n++)
595 whileIterationCount++;
597 Reader.MoveToContent ();
599 object item = ReadReferencingElement (itemType, qn.Namespace, out id);
601 list.SetValue (item,n);
604 AddFixup (new CollectionItemFixup (list, n, id));
605 listComplete = false;
608 whileIterationCount = 0;
609 Reader.ReadEndElement ();
616 protected void ReadReferencedElements ()
618 reader.MoveToContent();
619 XmlNodeType nt = reader.NodeType;
620 while (nt != XmlNodeType.EndElement && nt != XmlNodeType.None) {
621 whileIterationCount++;
623 ReadReferencedElement ();
624 reader.MoveToContent ();
625 nt = reader.NodeType;
627 whileIterationCount = 0;
629 // Registers delayed list
631 if (delayedListFixups != null)
633 foreach (DictionaryEntry entry in delayedListFixups)
634 AddTarget ((string)entry.Key, entry.Value);
638 if (collItemFixups != null)
640 foreach (CollectionItemFixup itemFixup in collItemFixups)
641 itemFixup.Collection.SetValue (GetTarget (itemFixup.Id), itemFixup.Index);
646 if (collFixups != null)
648 ICollection cfixups = collFixups.Values;
649 foreach (CollectionFixup fixup in cfixups)
650 fixup.Callback (fixup.Collection, fixup.CollectionItems);
653 // Fills class instances
657 foreach (Fixup fixup in fixups)
658 fixup.Callback (fixup);
661 if (targets != null) {
662 foreach (DictionaryEntry e in targets) {
663 if (e.Value != null && (referencedObjects == null || !referencedObjects.Contains (e.Value)))
664 UnreferencedObject ((string)e.Key, e.Value);
669 protected object ReadReferencingElement (out string fixupReference)
671 return ReadReferencingElement (Reader.LocalName, Reader.NamespaceURI, false, out fixupReference);
674 protected object ReadReferencingElement (string name, string ns, out string fixupReference)
676 return ReadReferencingElement (name, ns, false, out fixupReference);
679 protected object ReadReferencingElement (string name,
681 bool elementCanBeType,
682 out string fixupReference)
686 fixupReference = null;
690 string refid = Reader.GetAttribute ("href");
692 if (refid == string.Empty || refid == null)
694 fixupReference = null;
696 XmlQualifiedName qname = GetXsiType ();
697 if (qname == null) qname = new XmlQualifiedName (name, ns);
698 string arrayTypeAttr = Reader.GetAttribute (arrayType, soapNS);
700 if (qname == arrayQName || arrayTypeAttr != null)
702 delayedListFixups = EnsureHashtable (delayedListFixups);
703 fixupReference = "__<" + (delayedFixupId++) + ">";
705 ReadList (out items);
706 delayedListFixups [fixupReference] = items;
711 WriteCallbackInfo info = GetCallbackInfo (qname);
713 return ReadTypedPrimitive (qname, true);
715 return info.Callback();
720 if (refid.StartsWith ("#")) refid = refid.Substring (1);
724 if (TargetReady (refid))
726 fixupReference = null;
727 return GetTarget (refid);
731 fixupReference = refid;
737 protected IXmlSerializable ReadSerializable (IXmlSerializable serializable)
739 if (ReadNull ()) return null;
740 int depth = reader.Depth;
742 serializable.ReadXml (reader);
743 Reader.MoveToContent ();
744 while (reader.Depth > depth)
746 if (reader.Depth == depth && reader.NodeType == XmlNodeType.EndElement)
747 reader.ReadEndElement ();
751 protected string ReadString (string value)
754 if (value == null || value == String.Empty)
755 return reader.ReadString ();
757 return (value + reader.ReadString ());
760 protected object ReadTypedPrimitive (XmlQualifiedName type)
762 return ReadTypedPrimitive (type, false);
765 object ReadTypedPrimitive (XmlQualifiedName qname, bool reportUnknown)
767 if (qname == null) qname = GetXsiType ();
769 TypeData typeData = TypeTranslator.FindPrimitiveTypeData (qname.Name);
770 if (typeData == null || typeData.SchemaType != SchemaTypes.Primitive)
775 return new Object ();
777 // Put everything into a node array
779 XmlNode node = Document.ReadNode (reader);
782 OnUnknownNode (node, null, null);
784 if (node.ChildNodes.Count == 0 && node.Attributes.Count == 0)
785 return new Object ();
787 XmlElement elem = node as XmlElement;
790 return new XmlNode[] {node};
792 XmlNode[] nodes = new XmlNode[elem.Attributes.Count + elem.ChildNodes.Count];
794 foreach (XmlNode no in elem.Attributes)
796 foreach (XmlNode no in elem.ChildNodes)
803 if (typeData.Type == typeof (XmlQualifiedName)) return ReadNullableQualifiedName ();
805 return XmlCustomFormatter.FromXmlString (typeData, Reader.ReadElementString ());
809 protected XmlNode ReadXmlNode (bool wrapped)
812 XmlNode node = Document.ReadNode (reader);
814 return node.FirstChild;
819 protected XmlDocument ReadXmlDocument (bool wrapped)
824 reader.ReadStartElement ();
825 reader.MoveToContent ();
826 XmlDocument doc = new XmlDocument ();
827 XmlNode node = doc.ReadNode (reader);
828 doc.AppendChild (node);
831 reader.ReadEndElement ();
837 protected void Referenced (object o)
840 if (referencedObjects == null) referencedObjects = new Hashtable ();
841 referencedObjects [o] = o;
845 protected Array ShrinkArray (Array a, int length, Type elementType, bool isNullable)
847 if (length == 0 && isNullable) return null;
848 if (a == null) return Array.CreateInstance (elementType, length);
849 if (a.Length == length) return a;
851 Array result = Array.CreateInstance (elementType, length);
852 Array.Copy (a, result, length);
856 protected byte[] ToByteArrayBase64 (bool isNull)
860 Reader.ReadString ();
864 return ToByteArrayBase64 (Reader.ReadString ());
867 protected static byte[] ToByteArrayBase64 (string value)
869 return Convert.FromBase64String (value);
872 protected byte[] ToByteArrayHex (bool isNull)
876 Reader.ReadString ();
880 return ToByteArrayHex (Reader.ReadString ());
883 protected static byte[] ToByteArrayHex (string value)
885 return XmlConvert.FromBinHexString (value);
888 protected static char ToChar (string value)
890 return XmlCustomFormatter.ToChar (value);
893 protected static DateTime ToDate (string value)
895 return XmlCustomFormatter.ToDate (value);
898 protected static DateTime ToDateTime (string value)
900 return XmlCustomFormatter.ToDateTime (value);
904 protected static long ToEnum (string value, IDictionary h, string typeName)
906 return XmlCustomFormatter.ToEnum (value, (Hashtable) h, typeName, true);
909 protected static long ToEnum (string value, Hashtable h, string typeName)
911 return XmlCustomFormatter.ToEnum (value, h, typeName, true);
915 protected static DateTime ToTime (string value)
917 return XmlCustomFormatter.ToTime (value);
920 protected static string ToXmlName (string value)
922 return XmlCustomFormatter.ToXmlName (value);
925 protected static string ToXmlNCName (string value)
927 return XmlCustomFormatter.ToXmlNCName (value);
930 protected static string ToXmlNmToken (string value)
932 return XmlCustomFormatter.ToXmlNmToken (value);
935 protected static string ToXmlNmTokens (string value)
937 return XmlCustomFormatter.ToXmlNmTokens (value);
940 protected XmlQualifiedName ToXmlQualifiedName (string value)
944 int lastColon = value.LastIndexOf (':');
945 string decodedValue = XmlConvert.DecodeName (value);
947 name = reader.NameTable.Add (decodedValue);
948 ns = reader.LookupNamespace (String.Empty);
950 string prefix = value.Substring (0, lastColon);
951 ns = reader.LookupNamespace (prefix);
953 throw new InvalidOperationException ("namespace " + prefix + " not defined");
955 name = reader.NameTable.Add (value.Substring (lastColon + 1));
958 return new XmlQualifiedName (name, ns);
962 protected void UnknownNode (object o)
964 throw new NotSupportedException ();
967 protected void UnknownAttribute (object o, XmlAttribute attr)
969 UnknownAttribute (o, attr, null);
975 void UnknownAttribute (object o, XmlAttribute attr, string qnames)
977 int line_number, line_position;
979 if (Reader is XmlTextReader){
980 line_number = ((XmlTextReader)Reader).LineNumber;
981 line_position = ((XmlTextReader)Reader).LinePosition;
987 XmlAttributeEventArgs args = new XmlAttributeEventArgs (attr, line_number, line_position, o);
989 args.ExpectedAttributes = qnames;
992 if (eventSource != null)
993 eventSource.OnUnknownAttribute (args);
996 protected void UnknownElement (object o, XmlElement elem)
998 UnknownElement (o, elem, null);
1004 void UnknownElement (object o, XmlElement elem, string qnames)
1006 int line_number, line_position;
1008 if (Reader is XmlTextReader){
1009 line_number = ((XmlTextReader)Reader).LineNumber;
1010 line_position = ((XmlTextReader)Reader).LinePosition;
1016 XmlElementEventArgs args = new XmlElementEventArgs (elem, line_number, line_position, o);
1018 args.ExpectedElements = qnames;
1021 if (eventSource != null)
1022 eventSource.OnUnknownElement (args);
1025 protected void UnknownNode (object o)
1027 UnknownNode (o, null);
1033 void UnknownNode (object o, string qnames)
1035 OnUnknownNode (ReadXmlNode (false), o, qnames);
1038 void OnUnknownNode (XmlNode node, object o, string qnames)
1040 int line_number, line_position;
1042 if (Reader is XmlTextReader){
1043 line_number = ((XmlTextReader)Reader).LineNumber;
1044 line_position = ((XmlTextReader)Reader).LinePosition;
1050 if (node is XmlAttribute)
1052 UnknownAttribute (o, (XmlAttribute)node, qnames);
1055 else if (node is XmlElement)
1057 UnknownElement (o, (XmlElement) node, qnames);
1062 if (eventSource != null)
1063 eventSource.OnUnknownNode (new XmlNodeEventArgs(line_number, line_position, node.LocalName, node.Name, node.NamespaceURI, node.NodeType, o, node.Value));
1065 if (Reader.ReadState == ReadState.EndOfFile)
1066 throw new InvalidOperationException ("End of document found");
1071 protected void UnreferencedObject (string id, object o)
1073 if (eventSource != null)
1074 eventSource.OnUnreferencedObject (new UnreferencedObjectEventArgs (o,id));
1077 #endregion // Methods
1079 class WriteCallbackInfo
1082 public string TypeName;
1083 public string TypeNs;
1084 public XmlSerializationReadCallback Callback;
1087 protected class CollectionFixup {
1089 XmlSerializationCollectionFixupCallback callback;
1091 object collectionItems;
1094 public CollectionFixup (object collection, XmlSerializationCollectionFixupCallback callback, string id)
1096 this.callback = callback;
1097 this.collection = collection;
1101 public XmlSerializationCollectionFixupCallback Callback {
1102 get { return callback; }
1105 public object Collection {
1106 get { return collection; }
1113 internal object CollectionItems
1115 get { return collectionItems; }
1116 set { collectionItems = value; }
1120 protected class Fixup {
1124 XmlSerializationFixupCallback callback;
1126 public Fixup (object o, XmlSerializationFixupCallback callback, int count)
1129 this.callback = callback;
1130 this.ids = new string[count];
1133 public Fixup (object o, XmlSerializationFixupCallback callback, string[] ids)
1137 this.callback = callback;
1140 public XmlSerializationFixupCallback Callback {
1141 get { return callback; }
1144 public string[] Ids {
1148 public object Source {
1149 get { return source; }
1150 set { source = value; }
1154 protected class CollectionItemFixup
1160 public CollectionItemFixup (Array list, int index, string id)
1167 public Array Collection
1169 get { return list; }
1174 get { return index; }
1185 protected bool DecodeName
1187 get { throw new NotImplementedException(); }
1188 set { throw new NotImplementedException(); }
1191 protected string CollapseWhitespace (string value)
1193 return value == null ? null : value.Trim ();
1197 protected Exception CreateBadDerivationException (
1205 throw new NotImplementedException ();
1209 protected Exception CreateInvalidCastException (Type type, object value, string id)
1211 throw new NotImplementedException ();
1215 protected Exception CreateMissingIXmlSerializableType (string name, string ns, string clrType)
1217 throw new NotImplementedException ();
1221 protected string ReadString (string value, bool trim)
1223 throw new NotImplementedException ();
1227 protected object ReadTypedNull (XmlQualifiedName type)
1229 throw new NotImplementedException ();
1233 protected static Assembly ResolveDynamicAssembly (string assemblyFullName)
1235 throw new NotImplementedException ();