Beispiel #1
0
 private void WriteEmail(string elementName, GpxEmail email)
 {
     Writer_.WriteStartElement(elementName);
     Writer_.WriteAttributeString("id", email.Id);
     Writer_.WriteAttributeString("domain", email.Domain);
     Writer_.WriteEndElement();
 }
Beispiel #2
0
        private GpxEmail ReadGpxEmail()
        {
            GpxEmail email = new GpxEmail();

            if (Reader_.IsEmptyElement)
            {
                return(email);
            }

            string elementName = Reader_.Name;

            while (Reader_.Read())
            {
                switch (Reader_.NodeType)
                {
                case XmlNodeType.Element:

                    switch (Reader_.Name)
                    {
                    case "id":
                        email.Id = ReadContentAsString();
                        break;

                    case "domain":
                        email.Domain = ReadContentAsString();
                        break;

                    default:
                        SkipElement();
                        break;
                    }

                    break;

                case XmlNodeType.EndElement:
                    if (Reader_.Name != elementName)
                    {
                        throw new FormatException(Reader_.Name);
                    }
                    return(email);
                }
            }

            throw new FormatException(elementName);
        }