XmlDocumentNavigator.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. //
  2. // System.Xml.XmlDocumentNavigator
  3. //
  4. // Authors:
  5. // Jason Diamond <[email protected]>
  6. // Atsushi Enomoto <[email protected]>
  7. //
  8. // (C) 2002 Jason Diamond
  9. // (C) 2003 Atsushi Enomoto
  10. //
  11. //
  12. // Permission is hereby granted, free of charge, to any person obtaining
  13. // a copy of this software and associated documentation files (the
  14. // "Software"), to deal in the Software without restriction, including
  15. // without limitation the rights to use, copy, modify, merge, publish,
  16. // distribute, sublicense, and/or sell copies of the Software, and to
  17. // permit persons to whom the Software is furnished to do so, subject to
  18. // the following conditions:
  19. //
  20. // The above copyright notice and this permission notice shall be
  21. // included in all copies or substantial portions of the Software.
  22. //
  23. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  27. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  28. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  29. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  30. //
  31. using System;
  32. using System.Collections;
  33. using System.Xml;
  34. using System.Xml.XPath;
  35. namespace System.Xml
  36. {
  37. internal class XmlDocumentNavigator : XPathNavigator, IHasXmlNode
  38. {
  39. #region Constructors
  40. internal XmlDocumentNavigator (XmlNode node)
  41. : this (node, null)
  42. {
  43. nsNodeXml = document.CreateAttribute ("xmlns", "xml", Xmlns);
  44. nsNodeXml.Value = XmlnsXML;
  45. if (node.NodeType == XmlNodeType.Attribute && node.NamespaceURI == XmlNamespaceManager.XmlnsXmlns) {
  46. nsNode = (XmlAttribute) node;
  47. node = nsNode.OwnerElement;
  48. }
  49. }
  50. private XmlDocumentNavigator (XmlNode node, XmlAttribute nsNodeXml)
  51. {
  52. this.node = node;
  53. this.document = node.NodeType == XmlNodeType.Document ?
  54. node as XmlDocument : node.OwnerDocument;
  55. this.nsNodeXml = nsNodeXml;
  56. }
  57. #endregion
  58. #region Fields
  59. private const string Xmlns = "http://www.w3.org/2000/xmlns/";
  60. private const string XmlnsXML = "http://www.w3.org/XML/1998/namespace";
  61. private XmlAttribute nsNodeXml;
  62. private XmlNode node;
  63. private XmlDocument document;
  64. // Current namespace node (ancestor's attribute of current node).
  65. private XmlAttribute nsNode;
  66. private ArrayList iteratedNsNames;
  67. #endregion
  68. #region Properties
  69. public override string BaseURI {
  70. get {
  71. return node.BaseURI;
  72. }
  73. }
  74. public override bool HasAttributes {
  75. get {
  76. if (NsNode != null)
  77. return false;
  78. if (node.Attributes != null)
  79. for (int i = 0; i < node.Attributes.Count; i++)
  80. if (node.Attributes [i].NamespaceURI != Xmlns)
  81. return true;
  82. return false;
  83. }
  84. }
  85. public override bool HasChildren {
  86. get {
  87. if (NsNode != null)
  88. return false;
  89. XPathNodeType nodeType = NodeType;
  90. bool canHaveChildren = nodeType == XPathNodeType.Root || nodeType == XPathNodeType.Element;
  91. return canHaveChildren && GetFirstChild (node) != null;
  92. }
  93. }
  94. public override bool IsEmptyElement {
  95. get {
  96. if (NsNode != null)
  97. return false;
  98. return node.NodeType == XmlNodeType.Element
  99. && ((XmlElement) node).IsEmpty;
  100. }
  101. }
  102. public XmlAttribute NsNode {
  103. get { return nsNode; }
  104. set {
  105. if (value == null)
  106. iteratedNsNames = null;
  107. else
  108. {
  109. if (iteratedNsNames == null)
  110. iteratedNsNames = new ArrayList();
  111. else
  112. {
  113. if (iteratedNsNames.IsReadOnly)
  114. iteratedNsNames = new ArrayList(iteratedNsNames);
  115. }
  116. iteratedNsNames.Add (value.Name);
  117. }
  118. nsNode = value;
  119. }
  120. }
  121. public override string LocalName {
  122. get {
  123. XmlAttribute nsNode = NsNode;
  124. if (nsNode != null) {
  125. if (nsNode == nsNodeXml)
  126. return "xml";
  127. else
  128. return (nsNode.Name == "xmlns") ? String.Empty : nsNode.LocalName;
  129. }
  130. XPathNodeType nodeType = NodeType;
  131. bool canHaveName =
  132. nodeType == XPathNodeType.Element ||
  133. nodeType == XPathNodeType.Attribute ||
  134. nodeType == XPathNodeType.ProcessingInstruction ||
  135. nodeType == XPathNodeType.Namespace;
  136. return canHaveName ? node.LocalName : String.Empty;
  137. }
  138. }
  139. public override string Name {
  140. get {
  141. if (NsNode != null)
  142. return LocalName;
  143. XPathNodeType nodeType = NodeType;
  144. bool canHaveName =
  145. nodeType == XPathNodeType.Element ||
  146. nodeType == XPathNodeType.Attribute ||
  147. nodeType == XPathNodeType.ProcessingInstruction ||
  148. nodeType == XPathNodeType.Namespace;
  149. return canHaveName ? node.Name : String.Empty;
  150. }
  151. }
  152. public override string NamespaceURI {
  153. get { return (NsNode != null) ? String.Empty : node.NamespaceURI; }
  154. }
  155. public override XmlNameTable NameTable {
  156. get {
  157. return document.NameTable;
  158. }
  159. }
  160. public override XPathNodeType NodeType {
  161. get {
  162. if (NsNode != null)
  163. return XPathNodeType.Namespace;
  164. XmlNode n = node;
  165. bool sw = false;
  166. do {
  167. switch (n.NodeType) {
  168. case XmlNodeType.SignificantWhitespace:
  169. sw = true;
  170. n = GetNextSibling (n);
  171. break;
  172. case XmlNodeType.Whitespace:
  173. n = GetNextSibling (n);
  174. break;
  175. case XmlNodeType.Text:
  176. case XmlNodeType.CDATA:
  177. return XPathNodeType.Text;
  178. default:
  179. n = null;
  180. break;
  181. }
  182. } while (n != null);
  183. return sw ?
  184. XPathNodeType.SignificantWhitespace :
  185. node.XPathNodeType;
  186. }
  187. }
  188. public override string Prefix {
  189. get { return (NsNode != null) ? String.Empty : node.Prefix; }
  190. }
  191. public override string Value {
  192. get {
  193. switch (NodeType) {
  194. case XPathNodeType.Attribute:
  195. case XPathNodeType.Comment:
  196. case XPathNodeType.ProcessingInstruction:
  197. return node.Value;
  198. case XPathNodeType.Text:
  199. case XPathNodeType.Whitespace:
  200. case XPathNodeType.SignificantWhitespace:
  201. string value = node.Value;
  202. for (XmlNode n = GetNextSibling (node); n != null; n = GetNextSibling (n)) {
  203. switch (n.XPathNodeType) {
  204. case XPathNodeType.Text:
  205. case XPathNodeType.Whitespace:
  206. case XPathNodeType.SignificantWhitespace:
  207. value += n.Value;
  208. continue;
  209. }
  210. break;
  211. }
  212. return value;
  213. case XPathNodeType.Element:
  214. case XPathNodeType.Root:
  215. return node.InnerText;
  216. case XPathNodeType.Namespace:
  217. return NsNode == nsNodeXml ? XmlnsXML : NsNode.Value;
  218. }
  219. return String.Empty;
  220. }
  221. }
  222. public override string XmlLang {
  223. get {
  224. return node.XmlLang;
  225. }
  226. }
  227. #endregion
  228. #region Methods
  229. private bool CheckNsNameAppearance (string name, string ns)
  230. {
  231. if (iteratedNsNames != null && iteratedNsNames.Contains (name))
  232. return true;
  233. // default namespace erasure - just add name and never return this node
  234. if (ns == String.Empty) {
  235. if (iteratedNsNames == null)
  236. iteratedNsNames = new ArrayList();
  237. else
  238. {
  239. if (iteratedNsNames.IsReadOnly)
  240. iteratedNsNames = new ArrayList(iteratedNsNames);
  241. }
  242. iteratedNsNames.Add ("xmlns");
  243. return true;
  244. }
  245. return false;
  246. }
  247. public override XPathNavigator Clone ()
  248. {
  249. XmlDocumentNavigator clone = new XmlDocumentNavigator (node, nsNodeXml);
  250. clone.nsNode = nsNode;
  251. clone.iteratedNsNames = (iteratedNsNames == null || iteratedNsNames.IsReadOnly) ? iteratedNsNames : ArrayList.ReadOnly(iteratedNsNames);
  252. return clone;
  253. }
  254. public override string GetAttribute (string localName, string namespaceURI)
  255. {
  256. if (HasAttributes) {
  257. XmlElement el = Node as XmlElement;
  258. return el != null ? el.GetAttribute (localName, namespaceURI) : String.Empty;
  259. }
  260. return String.Empty;
  261. }
  262. public override string GetNamespace (string name)
  263. {
  264. // MSDN says "String.Empty if a matching namespace
  265. // node is not found or if the navigator is not
  266. // positioned on an element node", but in fact it
  267. // returns actual namespace for the other nodes.
  268. return Node.GetNamespaceOfPrefix (name);
  269. }
  270. public override bool IsSamePosition (XPathNavigator other)
  271. {
  272. XmlDocumentNavigator otherDocumentNavigator = other as XmlDocumentNavigator;
  273. if (otherDocumentNavigator != null)
  274. return node == otherDocumentNavigator.node
  275. && NsNode == otherDocumentNavigator.NsNode;
  276. return false;
  277. }
  278. public override bool MoveTo (XPathNavigator other)
  279. {
  280. XmlDocumentNavigator otherDocumentNavigator = other as XmlDocumentNavigator;
  281. if (otherDocumentNavigator != null) {
  282. if (document == otherDocumentNavigator.document) {
  283. node = otherDocumentNavigator.node;
  284. NsNode = otherDocumentNavigator.NsNode;
  285. return true;
  286. }
  287. }
  288. return false;
  289. }
  290. public override bool MoveToAttribute (string localName, string namespaceURI)
  291. {
  292. if (node.Attributes != null) {
  293. for (int i = 0; i < node.Attributes.Count; i++) {
  294. XmlAttribute attr = node.Attributes [i];
  295. if (attr.LocalName == localName
  296. && attr.NamespaceURI == namespaceURI) {
  297. node = attr;
  298. NsNode = null;
  299. return true;
  300. }
  301. }
  302. }
  303. return false;
  304. }
  305. public override bool MoveToFirst ()
  306. {
  307. if (NsNode == null && node.NodeType != XmlNodeType.Attribute) {
  308. if (!MoveToParent ())
  309. return false;
  310. // Follow these 2 steps so that we can skip
  311. // some types of nodes .
  312. MoveToFirstChild ();
  313. return true;
  314. }
  315. return false;
  316. }
  317. public override bool MoveToFirstAttribute ()
  318. {
  319. if (node.Attributes == null)
  320. return false;
  321. if (NodeType == XPathNodeType.Element) {
  322. for (int i = 0; i < node.Attributes.Count; i++) {
  323. XmlAttribute attr = node.Attributes [i];
  324. if (attr.NamespaceURI != Xmlns) {
  325. node = attr;
  326. NsNode = null;
  327. return true;
  328. }
  329. }
  330. }
  331. return false;
  332. }
  333. public override bool MoveToFirstChild ()
  334. {
  335. if (HasChildren) {
  336. XmlNode n = GetFirstChild (node);
  337. if (n == null)
  338. return false;
  339. node = n;
  340. return true;
  341. }
  342. return false;
  343. }
  344. public override bool MoveToFirstNamespace (XPathNamespaceScope namespaceScope)
  345. {
  346. if (NodeType != XPathNodeType.Element)
  347. return false;
  348. XmlElement el = node as XmlElement;
  349. if (node.Attributes != null) {
  350. do {
  351. for (int i = 0; i < el.Attributes.Count; i++) {
  352. XmlAttribute attr = el.Attributes [i];
  353. if (attr.NamespaceURI == Xmlns) {
  354. if (CheckNsNameAppearance (attr.Name, attr.Value))
  355. continue;
  356. NsNode = attr;
  357. return true;
  358. }
  359. }
  360. if (namespaceScope == XPathNamespaceScope.Local)
  361. return false;
  362. el = GetParentNode (el) as XmlElement;
  363. } while (el != null);
  364. }
  365. if (namespaceScope == XPathNamespaceScope.All) {
  366. if (CheckNsNameAppearance (nsNodeXml.Name, nsNodeXml.Value))
  367. return false;
  368. NsNode = nsNodeXml;
  369. return true;
  370. }
  371. else
  372. return false;
  373. }
  374. public override bool MoveToId (string id)
  375. {
  376. XmlElement eltNew = document.GetElementById (id);
  377. if (eltNew == null)
  378. return false;
  379. node = eltNew;
  380. return true;
  381. }
  382. public override bool MoveToNamespace (string name)
  383. {
  384. if (name == "xml") {
  385. NsNode = nsNodeXml;
  386. return true;
  387. }
  388. if (NodeType != XPathNodeType.Element)
  389. return false;
  390. XmlElement el = node as XmlElement;
  391. if (node.Attributes != null) {
  392. do {
  393. for (int i = 0; i < el.Attributes.Count; i++) {
  394. XmlAttribute attr = el.Attributes [i];
  395. if (attr.NamespaceURI == Xmlns && attr.Name == name) {
  396. NsNode = attr;
  397. return true;
  398. }
  399. }
  400. el = GetParentNode (node) as XmlElement;
  401. } while (el != null);
  402. }
  403. return false;
  404. }
  405. public override bool MoveToNext ()
  406. {
  407. if (NsNode != null)
  408. return false;
  409. XmlNode n = node;
  410. if (NodeType == XPathNodeType.Text) {
  411. do {
  412. n = GetNextSibling (n);
  413. if (n == null)
  414. return false;
  415. switch (n.NodeType) {
  416. case XmlNodeType.CDATA:
  417. case XmlNodeType.SignificantWhitespace:
  418. case XmlNodeType.Text:
  419. case XmlNodeType.Whitespace:
  420. continue;
  421. default:
  422. break;
  423. }
  424. break;
  425. } while (true);
  426. }
  427. else
  428. n = GetNextSibling (n);
  429. if (n == null)
  430. return false;
  431. node = n;
  432. return true;
  433. }
  434. public override bool MoveToNextAttribute ()
  435. {
  436. if (node == null)
  437. return false;
  438. if (NodeType != XPathNodeType.Attribute)
  439. return false;
  440. // Find current attribute.
  441. int pos = 0;
  442. XmlElement owner = ((XmlAttribute) node).OwnerElement;
  443. if (owner == null)
  444. return false;
  445. int count = owner.Attributes.Count;
  446. for(; pos < count; pos++)
  447. if (owner.Attributes [pos] == node)
  448. break;
  449. if (pos == count)
  450. return false; // Where is current attribute? Maybe removed.
  451. // Find next attribute.
  452. for(pos++; pos < count; pos++) {
  453. if (owner.Attributes [pos].NamespaceURI != Xmlns) {
  454. node = owner.Attributes [pos];
  455. NsNode = null;
  456. return true;
  457. }
  458. }
  459. return false;
  460. }
  461. public override bool MoveToNextNamespace (XPathNamespaceScope namespaceScope)
  462. {
  463. if (NsNode == nsNodeXml)
  464. // Current namespace is "xml", so there should be no more namespace nodes.
  465. return false;
  466. if (NsNode == null)
  467. return false;
  468. // Get current attribute's position.
  469. int pos = 0;
  470. XmlElement owner = ((XmlAttribute) NsNode).OwnerElement;
  471. if (owner == null)
  472. return false;
  473. int count = owner.Attributes.Count;
  474. for(; pos < count; pos++)
  475. if (owner.Attributes [pos] == NsNode)
  476. break;
  477. if (pos == count)
  478. return false; // Where is current attribute? Maybe removed.
  479. // Find next namespace from the same element as current ns node.
  480. for(pos++; pos < count; pos++) {
  481. if (owner.Attributes [pos].NamespaceURI == Xmlns) {
  482. XmlAttribute a = owner.Attributes [pos];
  483. if (CheckNsNameAppearance (a.Name, a.Value))
  484. continue;
  485. NsNode = a;
  486. return true;
  487. }
  488. }
  489. // If not found more, then find from ancestors.
  490. // But if scope is Local, then it returns false here.
  491. if (namespaceScope == XPathNamespaceScope.Local)
  492. return false;
  493. owner = GetParentNode (owner) as XmlElement;
  494. while (owner != null) {
  495. for (int i = 0; i < owner.Attributes.Count; i++) {
  496. XmlAttribute attr = owner.Attributes [i];
  497. if (attr.NamespaceURI == Xmlns) {
  498. if (CheckNsNameAppearance (attr.Name, attr.Value))
  499. continue;
  500. NsNode = attr;
  501. return true;
  502. }
  503. }
  504. owner = GetParentNode (owner) as XmlElement;
  505. }
  506. if (namespaceScope == XPathNamespaceScope.All) {
  507. if (CheckNsNameAppearance (nsNodeXml.Name, nsNodeXml.Value))
  508. return false;
  509. NsNode = nsNodeXml;
  510. return true;
  511. }
  512. return false;
  513. }
  514. public override bool MoveToParent ()
  515. {
  516. if (NsNode != null) {
  517. NsNode = null;
  518. return true;
  519. }
  520. else if (node.NodeType == XmlNodeType.Attribute) {
  521. XmlElement ownerElement = ((XmlAttribute)node).OwnerElement;
  522. if (ownerElement != null) {
  523. node = ownerElement;
  524. NsNode = null;
  525. return true;
  526. }
  527. else
  528. return false;
  529. }
  530. XmlNode n = GetParentNode (node);
  531. if (n == null)
  532. return false;
  533. node = n;
  534. NsNode = null;
  535. return true;
  536. }
  537. public override bool MoveToPrevious ()
  538. {
  539. if (NsNode != null)
  540. return false;
  541. XmlNode p = GetPreviousSibling (node);
  542. if (p == null)
  543. return false;
  544. node = p;
  545. return true;
  546. }
  547. public override void MoveToRoot ()
  548. {
  549. XmlAttribute attr = node as XmlAttribute;
  550. XmlNode tmp = attr != null ? attr.OwnerElement : node;
  551. for (XmlNode tmp2 = GetParentNode (tmp); tmp2 != null; tmp2 = GetParentNode (tmp2))
  552. tmp = tmp2;
  553. node = tmp;
  554. NsNode = null;
  555. }
  556. private XmlNode Node { get { return NsNode != null ? NsNode : node; } }
  557. XmlNode IHasXmlNode.GetNode ()
  558. {
  559. return Node;
  560. }
  561. private XmlNode GetFirstChild (XmlNode n)
  562. {
  563. if (n.FirstChild == null)
  564. return null;
  565. switch (n.FirstChild.NodeType) {
  566. case XmlNodeType.XmlDeclaration:
  567. case XmlNodeType.DocumentType:
  568. return GetNextSibling (n.FirstChild);
  569. case XmlNodeType.EntityReference:
  570. foreach (XmlNode c in n.ChildNodes) {
  571. if (c.NodeType == XmlNodeType.EntityReference) {
  572. XmlNode ec = GetFirstChild (c);
  573. if (ec != null)
  574. return ec;
  575. }
  576. return c;
  577. }
  578. return null;
  579. default:
  580. return n.FirstChild;
  581. }
  582. }
  583. private XmlNode GetLastChild (XmlNode n)
  584. {
  585. if (n.LastChild == null)
  586. return null;
  587. switch (n.LastChild.NodeType) {
  588. case XmlNodeType.XmlDeclaration:
  589. case XmlNodeType.DocumentType:
  590. return GetPreviousSibling (n.LastChild);
  591. case XmlNodeType.EntityReference:
  592. for (XmlNode c = n.LastChild; c != null; c = c.PreviousSibling) {
  593. if (c.NodeType == XmlNodeType.EntityReference) {
  594. XmlNode ec = GetLastChild (c);
  595. if (ec != null)
  596. return ec;
  597. }
  598. return c;
  599. }
  600. return null;
  601. default:
  602. return n.LastChild;
  603. }
  604. }
  605. private XmlNode GetPreviousSibling (XmlNode n)
  606. {
  607. if (n.PreviousSibling != null) {
  608. switch (n.PreviousSibling.NodeType) {
  609. case XmlNodeType.EntityReference:
  610. XmlNode c = GetLastChild (n.PreviousSibling);
  611. if (c != null)
  612. return c;
  613. else // empty entity reference etc.
  614. return GetPreviousSibling (n.PreviousSibling);
  615. case XmlNodeType.XmlDeclaration:
  616. case XmlNodeType.DocumentType:
  617. return GetPreviousSibling (n.PreviousSibling);
  618. default:
  619. return n.PreviousSibling;
  620. }
  621. } else {
  622. if (n.ParentNode == null || n.ParentNode.NodeType != XmlNodeType.EntityReference)
  623. return null;
  624. return GetPreviousSibling (n.ParentNode);
  625. }
  626. }
  627. private XmlNode GetNextSibling (XmlNode n)
  628. {
  629. if (n.NextSibling != null) {
  630. switch (n.NextSibling.NodeType) {
  631. case XmlNodeType.EntityReference:
  632. XmlNode c = GetFirstChild (n.NextSibling);
  633. if (c != null)
  634. return c;
  635. else // empty entity reference etc.
  636. return GetNextSibling (n.NextSibling);
  637. case XmlNodeType.XmlDeclaration:
  638. case XmlNodeType.DocumentType:
  639. return GetNextSibling (n.NextSibling);
  640. default:
  641. return n.NextSibling;
  642. }
  643. } else {
  644. if (n.ParentNode == null || n.ParentNode.NodeType != XmlNodeType.EntityReference)
  645. return null;
  646. return GetNextSibling (n.ParentNode);
  647. }
  648. }
  649. private XmlNode GetParentNode (XmlNode n)
  650. {
  651. if (n.ParentNode == null)
  652. return null;
  653. for (XmlNode p = n.ParentNode; p != null; p = p.ParentNode)
  654. if (p.NodeType != XmlNodeType.EntityReference)
  655. return p;
  656. return null;
  657. }
  658. #endregion
  659. }
  660. }