Example #1
0
        public void ReadXml(XPathNavigator node)
        {
            bool movedToDocEl = false;

            if (node.NodeType == XPathNodeType.Root)
            {
                movedToDocEl = node.MoveToChild(XPathNodeType.Element);
            }

            if (node.NamespaceURI == XPathSmtpClient.Namespace &&
                node.LocalName == "message")
            {
                if (node.MoveToFirstAttribute())
                {
                    do
                    {
                        if (String.IsNullOrEmpty(node.NamespaceURI))
                        {
                        }
                    } while (node.MoveToNextAttribute());

                    node.MoveToParent();
                }

                if (node.MoveToChild(XPathNodeType.Element))
                {
                    do
                    {
                        if (node.NamespaceURI == XPathSmtpClient.Namespace)
                        {
                            switch (node.LocalName)
                            {
                            case "from":
                                this.From = new XPathMailAddress();
                                this.From.ReadXml(node);
                                break;

                            case "reply-to": {
                                var address = new XPathMailAddress();
                                address.ReadXml(node);

                                this.ReplyTo.Add(address);
                            }
                            break;

                            case "sender":
                                this.Sender = new XPathMailAddress();
                                this.Sender.ReadXml(node);
                                break;

                            case "to": {
                                var address = new XPathMailAddress();
                                address.ReadXml(node);

                                this.To.Add(address);
                            }
                            break;

                            case "cc": {
                                var address = new XPathMailAddress();
                                address.ReadXml(node);

                                this.CC.Add(address);
                            }
                            break;

                            case "bcc": {
                                var address = new XPathMailAddress();
                                address.ReadXml(node);

                                this.Bcc.Add(address);
                            }
                            break;

                            case "subject":
                                this.Subject = node.Value;
                                break;

                            case "body":
                                this.Body = new XPathMailBody();
                                this.Body.ReadXml(node);
                                break;

                            default:
                                break;
                            }
                        }
                    } while (node.MoveToNext(XPathNodeType.Element));

                    node.MoveToParent();
                }
            }

            if (movedToDocEl)
            {
                node.MoveToParent();
            }
        }
Example #2
0
        public void ReadXml(XPathNavigator node)
        {
            bool movedToDocEl = false;

             if (node.NodeType == XPathNodeType.Root) {
            movedToDocEl = node.MoveToChild(XPathNodeType.Element);
             }

             if (node.NamespaceURI == XPathSmtpClient.Namespace
            && node.LocalName == "message") {

            if (node.MoveToFirstAttribute()) {

               do {
                  if (String.IsNullOrEmpty(node.NamespaceURI)) {

                  }
               } while (node.MoveToNextAttribute());

               node.MoveToParent();
            }

            if (node.MoveToChild(XPathNodeType.Element)) {

               do {
                  if (node.NamespaceURI == XPathSmtpClient.Namespace) {

                     switch (node.LocalName) {
                        case "from":
                           this.From = new XPathMailAddress();
                           this.From.ReadXml(node);
                           break;

                        case "reply-to": {
                              var address = new XPathMailAddress();
                              address.ReadXml(node);

                              this.ReplyTo.Add(address);
                           }
                           break;

                        case "sender":
                           this.Sender = new XPathMailAddress();
                           this.Sender.ReadXml(node);
                           break;

                        case "to": {
                              var address = new XPathMailAddress();
                              address.ReadXml(node);

                              this.To.Add(address);
                           }
                           break;

                        case "cc": {
                              var address = new XPathMailAddress();
                              address.ReadXml(node);

                              this.CC.Add(address);
                           }
                           break;

                        case "bcc": {
                              var address = new XPathMailAddress();
                              address.ReadXml(node);

                              this.Bcc.Add(address);
                           }
                           break;

                        case "subject":
                           this.Subject = node.Value;
                           break;

                        case "body":
                           this.Body = new XPathMailBody();
                           this.Body.ReadXml(node);
                           break;

                        default:
                           break;
                     }
                  }

               } while (node.MoveToNext(XPathNodeType.Element));

               node.MoveToParent();
            }
             }

             if (movedToDocEl) {
            node.MoveToParent();
             }
        }