一次偶然的机会,我想既然 winform control 可以嵌入html中,以增强客户端的功能,
那么能否将其嵌入 xml中呢?
我本无意去实现它,可是后来发现了一个很好的例子,这个例子的存储采用的是xml方式,对我现在的项目很有利用价值,如果我能将winform control嵌入xml中,那么这个例子对我现在的项目的价值就更大了。于是开始写例子做测试,终于调试成功。
// test.xml 文件
<?xml version="1.0" encoding="GB2312" ?>
<?xml:stylesheet type="text/xsl" href="test.xsl"?>
<winformcontrols>
<id>WinFormServerControl</id>
<classid>WinFormIEControls.dll#WinFormIEControls.ServerControl</classid>
<height>200px</height>
<width>220px</width>
<viewmode>VIEWASTEXT</viewmode>
</winformcontrols>
//test.xsl
<?xml version="1.0" encoding="GB2312" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<xsl:apply-templates select="winformcontrols" />
</xsl:template>
<xsl:template match="winformcontrols">
<xsl:element name="object">
<xsl:attribute name="id">
<xsl:value-of select="id" />
</xsl:attribute>
<xsl:attribute name="classid">
<xsl:value-of select="classid" />
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
浙公网安备 33010602011771号