Exemplo n.º 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)
        {
            PartyNameType partytemp;
            AddressType   addresstemp;
            ContactNumber contacttemp;
            ElectronicAddressIdentifier eletemp;
            Identifier idtemp;

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

                switch (childNode.LocalName)
                {
                case "PartyName":
                    partytemp = new PartyNameType();
                    partytemp.ReadXML(childNode);
                    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 "OrganisationInformation":
                    this.orgInfo = new OrganizationInfo();
                    this.orgInfo.ReadXML(childNode);
                    break;

                case "#comment":
                    break;

                default:
                    throw new ArgumentException("Unexpected Node Name: " + childNode.Name + " in PersonDetails");
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads an XML Position From An Existing DOM
        /// </summary>
        /// <param name="rootnode">Node Containing the GML Position</param>
        public void ReadXML(XmlNode rootnode)
        {
            AddressType   addrtemp;
            ContactNumber contacttemp;
            ElectronicAddressIdentifier eletemp;

            if (rootnode.LocalName == "OrganizationInformation")
            {
                foreach (XmlNode childnode in rootnode.ChildNodes)
                {
                    if (string.IsNullOrEmpty(childnode.InnerText))
                    {
                        continue;
                    }

                    switch (childnode.LocalName)
                    {
                    case "OrganisationName":
                        this.orgName = new OrganizationName();
                        this.orgName.ReadXML(childnode);
                        break;

                    case "Addresses":
                        foreach (XmlNode addressnode in childnode.ChildNodes)
                        {
                            addrtemp = new AddressType();
                            addrtemp.ReadXML(addressnode);
                            this.addresses.Add(addrtemp);
                        }

                        break;

                    case "ContactNumbers":
                        foreach (XmlNode contactnode in childnode.ChildNodes)
                        {
                            contacttemp = new ContactNumber();
                            contacttemp.ReadXML(contactnode);
                            this.contactNumbers.Add(contacttemp);
                        }

                        break;

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

                        break;

                    case "OrganisationInformation":
                        this.orgInfo = new OrganizationInfo();
                        this.orgInfo.ReadXML(childnode);
                        break;

                    case "#comment":
                        break;

                    default:
                        throw new ArgumentException("Invalid Child Node Name: " + childnode.Name + " in OrganizationInformation");
                    }
                }
            }
            else
            {
                throw new ArgumentException("Unexpected Node Name: " + rootnode.Name + " in OrganizationInformation");
            }
        }