Example #1
0
 public static MapInfoDocument Parse(System.Xml.XmlDocument xmldoc, System.Xml.XmlNamespaceManager NameSpaceManager)
 {
     MapInfoDocument doc = new MapInfoDocument();
     doc.map = new CT_MapInfo();
     doc.map.Map = new System.Collections.Generic.List<CT_Map>();
     foreach (XmlElement mapNode in xmldoc.SelectNodes("d:MapInfo/d:Map", NameSpaceManager))
     { 
         CT_Map ctMap=new CT_Map();
         ctMap.ID = XmlHelper.ReadUInt(mapNode.GetAttributeNode("ID"));
         ctMap.Name = XmlHelper.ReadString(mapNode.GetAttributeNode("Name"));
         ctMap.RootElement = XmlHelper.ReadString(mapNode.GetAttributeNode("RootElement"));
         ctMap.SchemaID = XmlHelper.ReadString(mapNode.GetAttributeNode("SchemaID"));
         ctMap.ShowImportExportValidationErrors = XmlHelper.ReadBool(mapNode.GetAttributeNode("ShowImportExportValidationErrors"));
         ctMap.PreserveFormat = XmlHelper.ReadBool(mapNode.GetAttributeNode("PreserveFormat"));
         ctMap.PreserveSortAFLayout = XmlHelper.ReadBool(mapNode.GetAttributeNode("PreserveSortAFLayout"));
         ctMap.Append = XmlHelper.ReadBool(mapNode.GetAttributeNode("Append"));
         ctMap.AutoFit = XmlHelper.ReadBool(mapNode.GetAttributeNode("AutoFit"));
         doc.map.Map.Add(ctMap);
     }
     doc.map.Schema = new System.Collections.Generic.List<CT_Schema>();
     foreach (XmlNode schemaNode in xmldoc.SelectNodes("d:MapInfo/d:Schema", NameSpaceManager))
     {
         CT_Schema ctSchema = new CT_Schema();
         ctSchema.ID = schemaNode.Attributes["ID"].Value;
         if (schemaNode.Attributes["Namespace"] != null)
             ctSchema.Namespace = schemaNode.Attributes["Namespace"].Value;
         if (schemaNode.Attributes["SchemaRef"] != null)
             ctSchema.SchemaRef = schemaNode.Attributes["SchemaRef"].Value;
         ctSchema.InnerXml = schemaNode.InnerXml;
         doc.map.Schema.Add(ctSchema);
     }
     return doc;
 }
Example #2
0
        public static MapInfoDocument Parse(System.Xml.XmlDocument xmldoc, System.Xml.XmlNamespaceManager NameSpaceManager)
        {
            MapInfoDocument doc = new MapInfoDocument();

            doc.map     = new CT_MapInfo();
            doc.map.Map = new System.Collections.Generic.List <CT_Map>();
            foreach (XmlElement mapNode in xmldoc.SelectNodes("d:MapInfo/d:Map", NameSpaceManager))
            {
                CT_Map ctMap = new CT_Map();
                ctMap.ID          = XmlHelper.ReadUInt(mapNode.GetAttributeNode("ID"));
                ctMap.Name        = XmlHelper.ReadString(mapNode.GetAttributeNode("Name"));
                ctMap.RootElement = XmlHelper.ReadString(mapNode.GetAttributeNode("RootElement"));
                ctMap.SchemaID    = XmlHelper.ReadString(mapNode.GetAttributeNode("SchemaID"));
                ctMap.ShowImportExportValidationErrors = XmlHelper.ReadBool(mapNode.GetAttributeNode("ShowImportExportValidationErrors"));
                ctMap.PreserveFormat       = XmlHelper.ReadBool(mapNode.GetAttributeNode("PreserveFormat"));
                ctMap.PreserveSortAFLayout = XmlHelper.ReadBool(mapNode.GetAttributeNode("PreserveSortAFLayout"));
                ctMap.Append  = XmlHelper.ReadBool(mapNode.GetAttributeNode("Append"));
                ctMap.AutoFit = XmlHelper.ReadBool(mapNode.GetAttributeNode("AutoFit"));
                doc.map.Map.Add(ctMap);
            }
            doc.map.Schema = new System.Collections.Generic.List <CT_Schema>();
            foreach (XmlNode schemaNode in xmldoc.SelectNodes("d:MapInfo/d:Schema", NameSpaceManager))
            {
                CT_Schema ctSchema = new CT_Schema();
                ctSchema.ID = schemaNode.Attributes["ID"].Value;
                if (schemaNode.Attributes["Namespace"] != null)
                {
                    ctSchema.Namespace = schemaNode.Attributes["Namespace"].Value;
                }
                if (schemaNode.Attributes["SchemaRef"] != null)
                {
                    ctSchema.SchemaRef = schemaNode.Attributes["SchemaRef"].Value;
                }
                ctSchema.InnerXml = schemaNode.InnerXml;
                doc.map.Schema.Add(ctSchema);
            }
            return(doc);
        }
Example #3
0
 protected void WriteTo(Stream out1)
 {
     MapInfoDocument doc = new MapInfoDocument();
     doc.SetMapInfo(mapInfo);
     doc.Save(out1);
 }