private AOIDef[] ParseAOIDefs(XElement xElement, out AOIDef defaultAOI)
        {
            defaultAOI = null;
            if (xElement == null)
            {
                return(null);
            }
            var elements = xElement.Elements();

            if (elements == null || elements.Count() == 0)
            {
                return(null);
            }
            List <AOIDef> aois = new List <AOIDef>();

            foreach (XElement ele in elements)
            {
                if (ele.Name == "DefaultAOI")
                {
                    defaultAOI = GetAOIDef(ele);
                }
                else if (ele.Name == "AOI")
                {
                    AOIDef aoi = GetAOIDef(ele);
                    if (aoi != null)
                    {
                        aois.Add(aoi);
                    }
                }
            }
            return(aois.Count > 0 ? aois.ToArray() : null);
        }
        private AOIDef GetAOIDef(XElement ele)
        {
            AOIDef aoi = new AOIDef();

            aoi.Name     = AttributeValue(ele, "name");
            aoi.Provider = AttributeValue(ele, "provider");
            if (ele.Elements("AOI") != null)
            {
                AOIDef nulldef;
                aoi.SubAOIs = ParseAOIDefs(ele, out nulldef);
            }
            return(aoi);
        }