一个简单的基于XML的模块集成框架(3)
2008-02-23 05:50:49来源:互联网 阅读 ()
<xs:enumeration value="CtrlShiftI"/>
<xs:enumeration value="CtrlShiftJ"/>
<xs:enumeration value="CtrlShiftK"/>
<xs:enumeration value="CtrlShiftL"/>
<xs:enumeration value="CtrlShiftM"/>
<xs:enumeration value="CtrlShiftN"/>
<xs:enumeration value="CtrlShiftO"/>
<xs:enumeration value="CtrlShiftP"/>
<xs:enumeration value="CtrlShiftQ"/>
<xs:enumeration value="CtrlShiftR"/>
<xs:enumeration value="CtrlShiftS"/>
<xs:enumeration value="CtrlShiftT"/>
<xs:enumeration value="CtrlShiftU"/>
<xs:enumeration value="CtrlShiftV"/>
<xs:enumeration value="CtrlShiftW"/>
<xs:enumeration value="CtrlShiftX"/>
<xs:enumeration value="CtrlShiftY"/>
<xs:enumeration value="CtrlShiftZ"/>
<xs:enumeration value="ShiftIns"/>
<xs:enumeration value="ShiftF1"/>
<xs:enumeration value="ShiftF2"/>
<xs:enumeration value="ShiftF3"/>
<xs:enumeration value="ShiftF4"/>
<xs:enumeration value="ShiftF5"/>
<xs:enumeration value="ShiftF6"/>
<xs:enumeration value="ShiftF7"/>
<xs:enumeration value="ShiftF8"/>
<xs:enumeration value="ShiftF9"/>
<xs:enumeration value="ShiftF10"/>
<xs:enumeration value="ShiftF11"/>
<xs:enumeration value="ShiftF12"/>
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
3。定义一个类来加载菜单
public class MenuLoad
{
private PluginCollection m_plugins = null;
public MenuBar _menbar = new MenuBar();
public ToolStrip _toolbar = new ToolStrip();
private OutlookBar bar = new OutlookBar();
private ImageList imglist = new ImageList();
private StringBuilder builder = new StringBuilder();
public MenuLoad()
{
bar = _menbar.outlookBar;
}
private TabControl tabCtrl;
public TabControl TabCtrl
{
set
{
tabCtrl = value;
}
}
private void ValidationEventHandler(object sender, ValidationEventArgs e)
{
builder.AppendLine("验证XML文档的时候发生错误:");
builder.AppendLine("严重级别:" e.Severity);
builder.AppendLine("错误信息:" e.Message);
builder.AppendLine("------ -------- ------- ------ -------- ------- ------ -------- ------- ");
builder.AppendLine();
}
/**//// <summary>
/// 验证XML文件是否是合乎规范的文件
/// </summary>
/// <param name="xmlfile">文件名称</param>
/// <returns>是则返回true,否则返回false</returns>
private bool ValidateXml(string xmlfile)
{
bool validXml = false;
string spath = "";
spath = Application.StartupPath "\\configurations\\XMLSMenu.xsd";
if(!System.IO.File.Exists(spath))
{
throw new System.IO.FileNotFoundException(String.Format(Resources.StringFileNotFound, spath));
}
XmlReaderSettings settings = new XmlReaderSettings();
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.Add(null, spath);
settings.Schemas.Add(schemaSet);
settings.ValidationType = ValidationType.Schema;
settings.ValidationEventHandler = new ValidationEventHandler(ValidationEventHandler);
settings.ValidationFlags = settings.ValidationFlags | XmlSchemaValidationFlags.ReportValidationWarnings;
XmlReader reader = XmlReader.Create(xmlfile, settings);
while(reader.Read())
{
}
if(builder.Length > 0)
{
validXml = false;
}
else
{
validXml = true;
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:读取XML为行记录
下一篇:从XML中读取数据到内存的实例
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
