XmlSerializationWriter.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. //
  2. // System.Xml.Serialization.XmlSerializationWriter.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. // Lluis Sanchez Gual ([email protected])
  7. //
  8. // Copyright (C) Tim Coleman, 2002
  9. //
  10. using System;
  11. using System.Collections;
  12. using System.Text;
  13. using System.Xml;
  14. using System.Xml.Schema;
  15. using System.Runtime.Serialization;
  16. namespace System.Xml.Serialization {
  17. public abstract class XmlSerializationWriter {
  18. #region Fields
  19. ObjectIDGenerator idGenerator;
  20. int qnameCount;
  21. bool topLevelElement = false;
  22. ArrayList namespaces;
  23. XmlWriter writer;
  24. Queue referencedElements;
  25. Hashtable callbacks;
  26. const string xmlNamespace = "http://www.w3.org/2000/xmlns/";
  27. #endregion // Fields
  28. #region Constructors
  29. [MonoTODO]
  30. protected XmlSerializationWriter ()
  31. {
  32. qnameCount = 0;
  33. }
  34. #endregion // Constructors
  35. #region Properties
  36. protected ArrayList Namespaces {
  37. get { return namespaces; }
  38. set { namespaces = value; }
  39. }
  40. protected XmlWriter Writer {
  41. get { return writer; }
  42. set { writer = value; }
  43. }
  44. #endregion // Properties
  45. #region Methods
  46. internal void Initialize (XmlWriter writer)
  47. {
  48. this.writer = writer;
  49. }
  50. internal virtual void WriteObject (object ob)
  51. {
  52. throw new NotImplementedException ();
  53. }
  54. protected void AddWriteCallback (Type type, string typeName, string typeNs, XmlSerializationWriteCallback callback)
  55. {
  56. WriteCallbackInfo info = new WriteCallbackInfo ();
  57. info.Type = type;
  58. info.TypeName = typeName;
  59. info.TypeNs = typeNs;
  60. info.Callback = callback;
  61. if (callbacks == null) callbacks = new Hashtable ();
  62. callbacks.Add (type, info);
  63. }
  64. protected Exception CreateMismatchChoiceException (string value, string elementName, string enumValue)
  65. {
  66. string message = String.Format ("Value of {0} mismatches the type of {1}, you need to set it to {2}.", elementName, value, enumValue);
  67. return new InvalidOperationException (message);
  68. }
  69. protected Exception CreateUnknownAnyElementException (string name, string ns)
  70. {
  71. string message = String.Format ("The XML element named '{0}' from namespace '{1}' was not expected. The XML element name and namespace must match those provided via XmlAnyElementAttribute(s).", name, ns);
  72. return new InvalidOperationException (message);
  73. }
  74. protected Exception CreateUnknownTypeException (object o)
  75. {
  76. return CreateUnknownTypeException (o.GetType ());
  77. }
  78. protected Exception CreateUnknownTypeException (Type type)
  79. {
  80. string message = String.Format ("The type {0} may not be used in this context.", type);
  81. return new InvalidOperationException (message);
  82. }
  83. protected static string FromByteArrayBase64 (byte[] value)
  84. {
  85. return XmlCustomFormatter.FromByteArrayBase64 (value);
  86. }
  87. protected static string FromByteArrayHex (byte[] value)
  88. {
  89. return XmlCustomFormatter.FromByteArrayHex (value);
  90. }
  91. protected static string FromChar (char value)
  92. {
  93. return XmlCustomFormatter.FromChar (value);
  94. }
  95. protected static string FromDate (DateTime value)
  96. {
  97. return XmlCustomFormatter.FromDate (value);
  98. }
  99. protected static string FromDateTime (DateTime value)
  100. {
  101. return XmlCustomFormatter.FromDateTime (value);
  102. }
  103. protected static string FromEnum (long value, string[] values, long[] ids)
  104. {
  105. return XmlCustomFormatter.FromEnum (value, values, ids);
  106. }
  107. protected static string FromTime (DateTime value)
  108. {
  109. return XmlCustomFormatter.FromTime (value);
  110. }
  111. protected static string FromXmlName (string name)
  112. {
  113. return XmlCustomFormatter.FromXmlName (name);
  114. }
  115. protected static string FromXmlNCName (string ncName)
  116. {
  117. return XmlCustomFormatter.FromXmlNCName (ncName);
  118. }
  119. protected static string FromXmlNmToken (string nmToken)
  120. {
  121. return XmlCustomFormatter.FromXmlNmToken (nmToken);
  122. }
  123. protected static string FromXmlNmTokens (string nmTokens)
  124. {
  125. return XmlCustomFormatter.FromXmlNmTokens (nmTokens);
  126. }
  127. [MonoTODO ("Implement")]
  128. protected string FromXmlQualifiedName (XmlQualifiedName xmlQualifiedName)
  129. {
  130. return GetQualifiedName (xmlQualifiedName.Name, xmlQualifiedName.Namespace);
  131. }
  132. private string GetId (object o, bool addToReferencesList)
  133. {
  134. if (idGenerator == null) idGenerator = new ObjectIDGenerator ();
  135. bool firstTime;
  136. long lid = idGenerator.GetId (o, out firstTime);
  137. return String.Format ("id{0}", lid);
  138. }
  139. bool AlreadyQueued (object ob)
  140. {
  141. if (idGenerator == null) return false;
  142. bool firstTime;
  143. idGenerator.HasId (ob, out firstTime);
  144. return !firstTime;
  145. }
  146. private string GetNamespacePrefix (string ns)
  147. {
  148. string prefix = Writer.LookupPrefix (ns);
  149. if (prefix == null)
  150. {
  151. prefix = String.Format ("q{0}", ++qnameCount);
  152. WriteAttribute ("xmlns", prefix, null, ns);
  153. }
  154. return prefix;
  155. }
  156. [MonoTODO ("Need to check for namespace conflicts before blindly allocating qN")]
  157. private string GetQualifiedName (string name, string ns)
  158. {
  159. return String.Format ("{0}:{1}", GetNamespacePrefix (ns), name);
  160. }
  161. protected abstract void InitCallbacks ();
  162. protected void TopLevelElement ()
  163. {
  164. topLevelElement = true;
  165. }
  166. protected void WriteAttribute (string localName, byte[] value)
  167. {
  168. WriteAttribute (localName, String.Empty, value);
  169. }
  170. protected void WriteAttribute (string localName, string value)
  171. {
  172. WriteAttribute (String.Empty, localName, String.Empty, value);
  173. }
  174. protected void WriteAttribute (string localName, string ns, byte[] value)
  175. {
  176. if (value == null)
  177. return;
  178. Writer.WriteStartAttribute (localName, ns);
  179. WriteValue (value);
  180. Writer.WriteEndAttribute ();
  181. }
  182. protected void WriteAttribute (string localName, string ns, string value)
  183. {
  184. WriteAttribute (null, localName, ns, value);
  185. }
  186. protected void WriteAttribute (string prefix, string localName, string ns, string value)
  187. {
  188. if (value == null)
  189. return;
  190. Writer.WriteAttributeString (prefix, localName, ns, value);
  191. }
  192. protected void WriteElementEncoded (XmlNode node, string name, string ns, bool isNullable, bool any)
  193. {
  194. if (name != string.Empty)
  195. {
  196. if (node == null)
  197. {
  198. if (isNullable)
  199. WriteNullTagEncoded (name, ns);
  200. }
  201. else
  202. {
  203. Writer.WriteStartElement (name, ns);
  204. node.WriteTo (Writer);
  205. Writer.WriteEndElement ();
  206. }
  207. }
  208. else
  209. node.WriteTo (Writer);
  210. }
  211. protected void WriteElementLiteral (XmlNode node, string name, string ns, bool isNullable, bool any)
  212. {
  213. if (name != string.Empty)
  214. {
  215. if (node == null)
  216. {
  217. if (isNullable)
  218. WriteNullTagLiteral (name, ns);
  219. }
  220. else
  221. {
  222. Writer.WriteStartElement (name, ns);
  223. node.WriteTo (Writer);
  224. Writer.WriteEndElement ();
  225. }
  226. }
  227. else
  228. node.WriteTo (Writer);
  229. }
  230. protected void WriteElementQualifiedName (string localName, XmlQualifiedName value)
  231. {
  232. WriteElementQualifiedName (localName, String.Empty, value, null);
  233. }
  234. protected void WriteElementQualifiedName (string localName, string ns, XmlQualifiedName value)
  235. {
  236. WriteElementQualifiedName (localName, ns, value, null);
  237. }
  238. protected void WriteElementQualifiedName (string localName, XmlQualifiedName value, XmlQualifiedName xsiType)
  239. {
  240. WriteElementQualifiedName (localName, String.Empty, value, xsiType);
  241. }
  242. protected void WriteElementQualifiedName (string localName, string ns, XmlQualifiedName value, XmlQualifiedName xsiType)
  243. {
  244. localName = XmlCustomFormatter.FromXmlNCName (localName);
  245. WriteStartElement (localName, ns);
  246. Writer.WriteString (FromXmlQualifiedName (value));
  247. WriteEndElement ();
  248. }
  249. protected void WriteElementString (string localName, string value)
  250. {
  251. WriteElementString (localName, String.Empty, value, null);
  252. }
  253. protected void WriteElementString (string localName, string ns, string value)
  254. {
  255. WriteElementString (localName, ns, value, null);
  256. }
  257. protected void WriteElementString (string localName, string value, XmlQualifiedName xsiType)
  258. {
  259. WriteElementString (localName, String.Empty, value, xsiType);
  260. }
  261. [MonoTODO ("Implement")]
  262. protected void WriteElementString (string localName, string ns, string value, XmlQualifiedName xsiType)
  263. {
  264. if (value == null) return;
  265. if (xsiType != null) {
  266. localName = XmlCustomFormatter.FromXmlNCName (localName);
  267. WriteStartElement (localName, ns);
  268. WriteXsiType (xsiType.Name, xsiType.Namespace);
  269. Writer.WriteString (value);
  270. WriteEndElement ();
  271. }
  272. else
  273. Writer.WriteElementString (localName, ns, value);
  274. }
  275. protected void WriteElementStringRaw (string localName, byte[] value)
  276. {
  277. WriteElementStringRaw (localName, String.Empty, value, null);
  278. }
  279. protected void WriteElementStringRaw (string localName, string value)
  280. {
  281. WriteElementStringRaw (localName, String.Empty, value, null);
  282. }
  283. protected void WriteElementStringRaw (string localName, byte[] value, XmlQualifiedName xsiType)
  284. {
  285. WriteElementStringRaw (localName, String.Empty, value, xsiType);
  286. }
  287. protected void WriteElementStringRaw (string localName, string ns, byte[] value)
  288. {
  289. WriteElementStringRaw (localName, ns, value, null);
  290. }
  291. protected void WriteElementStringRaw (string localName, string ns, string value)
  292. {
  293. WriteElementStringRaw (localName, ns, value, null);
  294. }
  295. protected void WriteElementStringRaw (string localName, string value, XmlQualifiedName xsiType)
  296. {
  297. WriteElementStringRaw (localName, String.Empty, value, null);
  298. }
  299. [MonoTODO ("Implement")]
  300. protected void WriteElementStringRaw (string localName, string ns, byte[] value, XmlQualifiedName xsiType)
  301. {
  302. throw new NotImplementedException ();
  303. }
  304. [MonoTODO ("Implement")]
  305. protected void WriteElementStringRaw (string localName, string ns, string value, XmlQualifiedName xsiType)
  306. {
  307. localName = XmlCustomFormatter.FromXmlNCName (localName);
  308. WriteStartElement (localName, ns);
  309. if (xsiType != null)
  310. WriteXsiType (xsiType.Name, xsiType.Namespace);
  311. Writer.WriteRaw (value);
  312. WriteEndElement ();
  313. }
  314. protected void WriteEmptyTag (string name)
  315. {
  316. WriteEmptyTag (name, String.Empty);
  317. }
  318. [MonoTODO ("Verify")]
  319. protected void WriteEmptyTag (string name, string ns)
  320. {
  321. name = XmlCustomFormatter.FromXmlName (name);
  322. WriteStartElement (name, ns);
  323. WriteEndElement ();
  324. }
  325. protected void WriteEndElement ()
  326. {
  327. WriteEndElement (null);
  328. }
  329. [MonoTODO ("Implement")]
  330. protected void WriteEndElement (object o)
  331. {
  332. Writer.WriteEndElement ();
  333. }
  334. protected void WriteId (object o)
  335. {
  336. WriteAttribute ("id", GetId (o, true));
  337. }
  338. protected void WriteNamespaceDeclarations (XmlSerializerNamespaces ns)
  339. {
  340. if (ns == null)
  341. return;
  342. ICollection namespaces = ns.Namespaces.Values;
  343. foreach (XmlQualifiedName qn in namespaces) {
  344. WriteAttribute ("xmlns", qn.Name, xmlNamespace, qn.Namespace);
  345. }
  346. }
  347. [MonoTODO ("Implement")]
  348. protected void WriteNullableQualifiedNameEncoded (string name, string ns, XmlQualifiedName value, XmlQualifiedName xsiType)
  349. {
  350. throw new NotImplementedException ();
  351. }
  352. [MonoTODO ("Implement")]
  353. protected void WriteNullableQualifiedNameLiteral (string name, string ns, XmlQualifiedName value)
  354. {
  355. throw new NotImplementedException ();
  356. }
  357. protected void WriteNullableStringEncoded (string name, string ns, string value, XmlQualifiedName xsiType)
  358. {
  359. if (value != null)
  360. WriteElementString (name, ns, value, xsiType);
  361. else
  362. WriteNullTagEncoded (name, ns);
  363. }
  364. [MonoTODO ("Implement")]
  365. protected void WriteNullableStringEncodedRaw (string name, string ns, byte[] value, XmlQualifiedName xsiType)
  366. {
  367. throw new NotImplementedException ();
  368. }
  369. [MonoTODO ("Implement")]
  370. protected void WriteNullableStringEncodedRaw (string name, string ns, string value, XmlQualifiedName xsiType)
  371. {
  372. throw new NotImplementedException ();
  373. }
  374. protected void WriteNullableStringLiteral (string name, string ns, string value)
  375. {
  376. if (value != null)
  377. WriteElementString (name, ns, value, null);
  378. else
  379. WriteNullTagLiteral (name, ns);
  380. }
  381. [MonoTODO ("Implement")]
  382. protected void WriteNullableStringLiteralRaw (string name, string ns, byte[] value)
  383. {
  384. throw new NotImplementedException ();
  385. }
  386. [MonoTODO ("Implement")]
  387. protected void WriteNullableStringLiteralRaw (string name, string ns, string value)
  388. {
  389. throw new NotImplementedException ();
  390. }
  391. protected void WriteNullTagEncoded (string name)
  392. {
  393. WriteNullTagEncoded (name, String.Empty);
  394. }
  395. protected void WriteNullTagEncoded (string name, string ns)
  396. {
  397. WriteStartElement (name, ns);
  398. WriteAttribute ("xsi","null", XmlSchema.InstanceNamespace, "1");
  399. WriteEndElement ();
  400. }
  401. protected void WriteNullTagLiteral (string name)
  402. {
  403. WriteNullTagLiteral (name, String.Empty);
  404. }
  405. protected void WriteNullTagLiteral (string name, string ns)
  406. {
  407. WriteStartElement (name, ns);
  408. WriteAttribute ("xsi","nil", XmlSchema.InstanceNamespace, "true");
  409. WriteEndElement ();
  410. }
  411. protected void WritePotentiallyReferencingElement (string n, string ns, object o)
  412. {
  413. WritePotentiallyReferencingElement (n, ns, o, null, false, false);
  414. }
  415. protected void WritePotentiallyReferencingElement (string n, string ns, object o, Type ambientType)
  416. {
  417. WritePotentiallyReferencingElement (n, ns, o, ambientType, false, false);
  418. }
  419. protected void WritePotentiallyReferencingElement (string n, string ns, object o, Type ambientType, bool suppressReference)
  420. {
  421. WritePotentiallyReferencingElement (n, ns, o, ambientType, suppressReference, false);
  422. }
  423. protected void WritePotentiallyReferencingElement (string n, string ns, object o, Type ambientType, bool suppressReference, bool isNullable)
  424. {
  425. if (o == null)
  426. {
  427. if (isNullable) WriteNullTagEncoded (n, ns);
  428. return;
  429. }
  430. WriteStartElement (n, ns, o, true);
  431. CheckReferenceQueue ();
  432. if (callbacks.ContainsKey (o.GetType ()))
  433. {
  434. WriteCallbackInfo info = (WriteCallbackInfo) callbacks[o.GetType()];
  435. if (o.GetType ().IsEnum) {
  436. info.Callback (o);
  437. }
  438. else if (suppressReference) {
  439. Writer.WriteAttributeString ("id", GetId (o, false));
  440. if (ambientType != o.GetType ()) WriteXsiType(info.TypeName, info.TypeNs);
  441. info.Callback (o);
  442. }
  443. else {
  444. if (!AlreadyQueued (o)) referencedElements.Enqueue (o);
  445. Writer.WriteAttributeString ("href", "#" + GetId (o, true));
  446. }
  447. }
  448. else
  449. {
  450. // Must be a primitive type
  451. TypeData td = TypeTranslator.GetTypeData (o.GetType ());
  452. if (td.SchemaType != SchemaTypes.Primitive)
  453. throw new InvalidOperationException ("Invalid type: " + o.GetType().FullName);
  454. WriteXsiType(td.XmlType, XmlSchema.Namespace);
  455. Writer.WriteString (XmlCustomFormatter.ToXmlString (o));
  456. }
  457. WriteEndElement (o);
  458. }
  459. protected void WriteReferencedElements ()
  460. {
  461. if (referencedElements == null) return;
  462. if (callbacks == null) return;
  463. while (referencedElements.Count > 0)
  464. {
  465. object o = referencedElements.Dequeue ();
  466. TypeData td = TypeTranslator.GetTypeData (o.GetType ());
  467. WriteCallbackInfo info = (WriteCallbackInfo) callbacks[o.GetType()];
  468. WriteStartElement (info.TypeName, info.TypeNs, o, true);
  469. Writer.WriteAttributeString ("id", GetId (o, false));
  470. if (td.SchemaType != SchemaTypes.Array) // Array use its own "arrayType" attribute
  471. WriteXsiType(info.TypeName, info.TypeNs);
  472. info.Callback (o);
  473. WriteEndElement (o);
  474. }
  475. }
  476. protected void WriteReferencingElement (string n, string ns, object o)
  477. {
  478. WriteReferencingElement (n, ns, o, false);
  479. }
  480. protected void WriteReferencingElement (string n, string ns, object o, bool isNullable)
  481. {
  482. if (o == null)
  483. {
  484. if (isNullable) WriteNullTagEncoded (n, ns);
  485. return;
  486. }
  487. else
  488. {
  489. CheckReferenceQueue ();
  490. if (!AlreadyQueued (o)) referencedElements.Enqueue (o);
  491. Writer.WriteStartElement (n, ns);
  492. Writer.WriteAttributeString ("href", "#" + GetId (o, true));
  493. Writer.WriteEndElement ();
  494. }
  495. }
  496. void CheckReferenceQueue ()
  497. {
  498. if (referencedElements == null)
  499. {
  500. referencedElements = new Queue ();
  501. InitCallbacks ();
  502. }
  503. }
  504. [MonoTODO ("Implement")]
  505. protected void WriteSerializable (IXmlSerializable serializable, string name, string ns, bool isNullable)
  506. {
  507. throw new NotImplementedException ();
  508. }
  509. protected void WriteStartDocument ()
  510. {
  511. if (Writer.WriteState == WriteState.Start)
  512. Writer.WriteStartDocument ();
  513. }
  514. protected void WriteStartElement (string name)
  515. {
  516. WriteStartElement (name, String.Empty, null, false);
  517. }
  518. protected void WriteStartElement (string name, string ns)
  519. {
  520. WriteStartElement (name, ns, null, false);
  521. }
  522. protected void WriteStartElement (string name, string ns, bool writePrefixed)
  523. {
  524. WriteStartElement (name, ns, null, writePrefixed);
  525. }
  526. protected void WriteStartElement (string name, string ns, object o)
  527. {
  528. WriteStartElement (name, ns, o, false);
  529. }
  530. [MonoTODO]
  531. protected void WriteStartElement (string name, string ns, object o, bool writePrefixed)
  532. {
  533. WriteState oldState = Writer.WriteState;
  534. if (writePrefixed && ns != string.Empty) {
  535. name = XmlCustomFormatter.FromXmlName (name);
  536. string prefix = Writer.LookupPrefix (ns);
  537. if (prefix == null) prefix = "q" + (++qnameCount);
  538. Writer.WriteStartElement (prefix, name, ns);
  539. } else
  540. Writer.WriteStartElement (name, ns);
  541. if (topLevelElement) {
  542. WriteAttribute ("xmlns","xsd",xmlNamespace,XmlSchema.Namespace);
  543. WriteAttribute ("xmlns","xsi",xmlNamespace,XmlSchema.InstanceNamespace);
  544. }
  545. topLevelElement = false;
  546. }
  547. protected void WriteTypedPrimitive (string name, string ns, object o, bool xsiType)
  548. {
  549. string value;
  550. name = XmlCustomFormatter.FromXmlName (name);
  551. Writer.WriteStartElement (name, ns);
  552. if (o is XmlQualifiedName)
  553. value = FromXmlQualifiedName ((XmlQualifiedName) o);
  554. else
  555. value = XmlCustomFormatter.ToXmlString (o);
  556. if (xsiType)
  557. {
  558. TypeData td = TypeTranslator.GetTypeData (o.GetType ());
  559. if (td.SchemaType != SchemaTypes.Primitive)
  560. throw new InvalidOperationException ("Invalid type: " + o.GetType().FullName);
  561. WriteXsiType (td.XmlType, XmlSchema.Namespace);
  562. }
  563. WriteValue (value);
  564. Writer.WriteEndElement ();
  565. }
  566. protected void WriteValue (byte[] value)
  567. {
  568. Writer.WriteBase64 (value, 0, value.Length);
  569. }
  570. protected void WriteValue (string value)
  571. {
  572. Writer.WriteString (value);
  573. }
  574. protected void WriteXmlAttribute (XmlNode node)
  575. {
  576. WriteXmlAttribute (node, null);
  577. }
  578. [MonoTODO ("Implement")]
  579. protected void WriteXmlAttribute (XmlNode node, object container)
  580. {
  581. if (!(node is XmlAttribute))
  582. throw new InvalidOperationException ("The node must be either type XmlAttribute or a derived type.");
  583. throw new NotImplementedException ();
  584. }
  585. protected void WriteXsiType (string name, string ns)
  586. {
  587. if (ns != null && ns != string.Empty)
  588. WriteAttribute ("type", XmlSchema.InstanceNamespace, GetQualifiedName (name, ns));
  589. else
  590. WriteAttribute ("type", XmlSchema.InstanceNamespace, name);
  591. }
  592. #endregion
  593. class WriteCallbackInfo
  594. {
  595. public Type Type;
  596. public string TypeName;
  597. public string TypeNs;
  598. public XmlSerializationWriteCallback Callback;
  599. }
  600. }
  601. }