zoukankan      html  css  js  c++  java
  • XML Schema 配置文件自动生成c#类设计案例子

    步骤

    1.使用Altova XMLSpy按照需求设计生成xsd文件

    2.使用xsd验证xml文件

    3.使用批处理生成c#类文件

      参数如下:

    SET OUTPUT=D:\digitnexus-

    
    
    project\trunk\com.dn.Edgenode\com.dn.Edgenode.Core\Configuration
    SET DIR=D:\digitnexus-project\trunk\com.dn.Edgenode\com.dn.Edgenode.Core\Configuration
    SET FILE=EdgenodeConfig.xsd

    XSD /l:C# /c /nologo /n:com.dn.Edgenode.Core.Configuration %DIR%\%FILE% /o:%OUTPUT%

    第一个为类输出地址

    第二个xsd文件地址

    第三个xsd文件名字

    最后一行红色包含类的命名空间

    4.调用类文件:

     private edgenodeType _edgenodeCfg;
    
    string cfgPath = Path.Combine(Root, System.Configuration.ConfigurationManager.AppSettings["EdgenodeConfigFile"]);
    if (_edgenodeCfg == null)
    {
        if (File.Exists(cfgPath))
        {
            XmlDocument xml = new XmlDocument();
            xml.Load(cfgPath);
            string xmltxt = xml.OuterXml;
            _edgenodeCfg = edgenodeType.Parse(xmltxt);
        }
    }
    
  • 相关阅读:
    NSPrediccate 查询
    集合 不可变集合
    集合 不可变
    考核题 7
    考核题 6
    考核题 4
    练习题12
    练习题3
    iOS 实现在string任意位置添加新的表情
    在 ZBarSDK 中使用Block回调传值 Block在扫描成功后 变为空
  • 原文地址:https://www.cnblogs.com/sung/p/2824478.html
Copyright © 2011-2022 走看看