Exemplo n.º 1
0
        protected virtual ContactInformationType ReadContactInformtaion(XmlReader reader)
        {
            var contact = new ContactInformationType();

            while (reader.Read())
            {
                var nodeName = reader.Name.ToLower();
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (XmlContext.AdvanceReaderPastEmptyElement(reader))
                    {
                        //Empty element - advance and continue...
                        continue;
                    }

                    switch (nodeName)
                    {
                    case "contactname":
                        reader.Read();
                        contact.ContactName = reader.Value;
                        break;

                    case "typeofcontact":
                        reader.Read();
                        contact.TypeOfContact = reader.Value;
                        break;

                    case "phone":
                        reader.Read();
                        contact.Phone = reader.Value;
                        break;

                    case "email":
                        reader.Read();
                        contact.Email = reader.Value;
                        break;

                    case "address":
                        reader.Read();
                        contact.Address = reader.Value;
                        break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement && nodeName == "contactinformation")
                {
                    break;
                }
            }

            return(contact);
        }
Exemplo n.º 2
0
        protected virtual ContactInformationType ReadContactInformtaion(XmlReader reader)
        {
            var contact = new ContactInformationType();

            while (reader.Read())
            {
                var nodeName = reader.Name.ToLower();
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (XmlContext.AdvanceReaderPastEmptyElement(reader))
                    {
                        //Empty element - advance and continue...
                        continue;
                    }

                    switch (nodeName)
                    {
                        case "contactname":
                            reader.Read();
                            contact.ContactName = reader.Value;
                            break;
                        case "typeofcontact":
                            reader.Read();
                            contact.TypeOfContact = reader.Value;
                            break;
                        case "phone":
                            reader.Read();
                            contact.Phone = reader.Value;
                            break;
                        case "email":
                            reader.Read();
                            contact.Email = reader.Value;
                            break;
                        case "address":
                            reader.Read();
                            contact.Address = reader.Value;
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement && nodeName == "contactinformation")
                {
                    break;
                }
            }

            return contact;
        }