Exemple #1
0
        /**
         * Gets the
         * @param schemaId the schema ID
         * @return CTSchema by it's ID
         */
        public Npoi.Core.OpenXmlFormats.Spreadsheet.CT_Schema GetCTSchemaById(String schemaId)
        {
            Npoi.Core.OpenXmlFormats.Spreadsheet.CT_Schema xmlSchema = null;

            foreach (Npoi.Core.OpenXmlFormats.Spreadsheet.CT_Schema schema in mapInfo.Schema)
            {
                if (schema.ID.Equals(schemaId))
                {
                    xmlSchema = schema;
                    break;
                }
            }
            return(xmlSchema);
        }
Exemple #2
0
        public static MapInfoDocument Parse(XDocument 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 (XElement mapNode in xmldoc.XPathSelectElements("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 (XElement schemaNode in xmldoc.XPathSelectElements("d:MapInfo/d:Schema", NameSpaceManager))
            {
                CT_Schema ctSchema = new CT_Schema();
                ctSchema.ID = schemaNode.AttributeValue("ID");
                if (schemaNode.Attribute("Namespace") != null)
                {
                    ctSchema.Namespace = schemaNode.AttributeValue("Namespace");
                }
                if (schemaNode.Attribute("SchemaRef") != null)
                {
                    ctSchema.Namespace = schemaNode.AttributeValue("SchemaRef");
                }
                ctSchema.InnerXml = schemaNode.InnerXml();
                doc.map.Schema.Add(ctSchema);
            }
            return(doc);
        }