public ExplorerContentMap(ExplorerConfiguration configuration, XmlNode map_node)
     : base(configuration, map_node)
 {
     foreach (XmlNode childNode in map_node.ChildNodes)
     {
         if (childNode.Name == configuration.getEventsTag())
         {
             eventsContainer = new ExplorerEventsContainer(configuration, childNode);
         }
         else if (childNode.Name == configuration.getContentsTag())
         {
             contentsContainer = new ExplorerContentsContainer(configuration, childNode);
         }
         else if (childNode.Name == configuration.getRegionsTag())
         {
             regionsContainer = new ExplorerRegionsContainer(configuration, this, childNode);
         }
     }
 }
        public ExplorerRegion(ExplorerConfiguration configuration, XmlNode region_node)
        {
            foreach (XmlAttribute attribute in region_node.Attributes)
            {
                if (attribute.Name == "name")
                {
                    name = attribute.Value;
                }
                else if(attribute.Name == "defaultimageid")
                {
                    defaultImageLocalId = attribute.Value;
                }
                else if (attribute.Name == "defaulttextid")
                {
                    defaultTextLocalId = attribute.Value;
                }
            }

            if (name == null)
            {
                throw new ExplorerParseXMLException(
                    "Name not supplied for content tag. Node: '" + region_node.OuterXml + "'", null);
            }

            foreach (XmlNode childNode in region_node.ChildNodes)
            {
                if (childNode.Name == configuration.getEventsTag())
                {
                    eventsContainer = new ExplorerEventsContainer(configuration, childNode);
                }
                else if (childNode.Name == configuration.getPointsTag())
                {
                    pointsContainer = new ExplorerPointsContainer(configuration, childNode);
                }
                else if (childNode.Name == configuration.getContentsTag())
                {
                    contentsContainer = new ExplorerContentsContainer(configuration, childNode);
                }
            }

            if(defaultImageLocalId != null)
            {
                ExplorerContentBase baseContentItem = contentsContainer.getByLocalId(defaultImageLocalId);
                if(baseContentItem == null)
                {
                    defaultImageLocalId = null;
                    throw new ExplorerParseXMLException(
                    "Default Image ID provided does not exist in node. Node: '" + region_node.OuterXml + "'", null);
                }

                if(!(baseContentItem is ExplorerContentImage))
                {
                    defaultImageLocalId = null;
                    throw new ExplorerParseXMLException(
                    "Default Image ID provided does not reference an image. Node: '" + region_node.OuterXml + "'", null);
                }
            }

            if (defaultTextLocalId != null)
            {
                ExplorerContentBase baseContentItem = contentsContainer.getByLocalId(defaultTextLocalId);
                if (baseContentItem == null)
                {
                    defaultTextLocalId = null;
                    throw new ExplorerParseXMLException(
                    "Default text ID provided does not exist in node. Node: '" + region_node.OuterXml + "'", null);
                }

                if (!(baseContentItem is ExplorerContentText))
                {
                    defaultTextLocalId = null;
                    throw new ExplorerParseXMLException(
                    "Default text ID provided does not reference an text. Node: '" + region_node.OuterXml + "'", null);
                }
            }
        }