Beispiel #1
0
        /*
         * /// <summary>
         * /// Free text description of the party as line 1, line 2, line n.
         * /// </summary>
         * public List<string> FreeTextLines
         * {
         * get { return freeTextLines; }
         * set { freeTextLines = value; }
         * }*/

        #endregion

        #region Public Member Functions

        /// <summary>
        /// Reads an XML Position From An Existing DOM
        /// </summary>
        /// <param name="rootnode">Node Containing the GML Position</param>
        public void ReadXML(XmlNode rootnode)
        {
            PersonNameType persontemp;
            AddressType    addresstemp;
            ContactNumber  contacttemp;
            ElectronicAddressIdentifier eletemp;
            Identifier idtemp;

            foreach (XmlNode childNode in rootnode.ChildNodes)
            {
                if (string.IsNullOrEmpty(childNode.InnerText))
                {
                    continue;
                }

                switch (childNode.LocalName)
                {
                /*
                 * case "FreeTextLines":
                 * foreach (XmlNode TextNode in childnode.ChildNodes)
                 * {
                 * if (TextNode.LocalName == "FreeTextLine")
                 * {
                 *  freeTextLines.Add(childnode.InnerText);
                 * }
                 * else
                 * {
                 *  throw new ArgumentException("Unexpected Node Name: " + TextNode.Name + " in PersonDetails");
                 * }
                 * }
                 * break;*/
                case "PersonName":
                    persontemp = new PersonNameType();
                    persontemp.ReadXML(childNode);
                    this.personName.Add(persontemp);
                    break;

                case "Addresses":
                    foreach (XmlNode addressNode in childNode.ChildNodes)
                    {
                        if (addressNode.LocalName == "Address")
                        {
                            addresstemp = new AddressType();
                            addresstemp.ReadXML(addressNode);
                            this.addresses.Add(addresstemp);
                        }
                        else
                        {
                            throw new ArgumentException("Unexpected Node Name: " + addressNode.Name + " in PersonDetails");
                        }
                    }

                    break;

                case "ContactNumbers":
                    foreach (XmlNode contactNode in childNode.ChildNodes)
                    {
                        if (contactNode.LocalName == "ContactNumber")
                        {
                            contacttemp = new ContactNumber();
                            contacttemp.ReadXML(contactNode);
                            this.contactNumbers.Add(contacttemp);
                        }
                        else
                        {
                            throw new ArgumentException("Unexpected Node Name: " + contactNode.Name + " in PersonDetails");
                        }
                    }

                    break;

                case "ElectronicAddressIdentifiers":
                    foreach (XmlNode subnode in childNode.ChildNodes)
                    {
                        eletemp = new ElectronicAddressIdentifier();
                        eletemp.ReadXML(subnode);
                        this.electronicAddressIdentifiers.Add(eletemp);
                    }

                    break;

                case "Identifiers":
                    foreach (XmlNode subnode in childNode.ChildNodes)
                    {
                        idtemp = new Identifier();
                        idtemp.ReadXML(subnode);
                        this.identifiers.Add(idtemp);
                    }

                    break;

                case "#comment":
                    break;

                default:
                    throw new ArgumentException("Unexpected Node Name: " + childNode.Name + " in PersonDetails");
                }
            }
        }