2014-08-30 53 views
0

我正在开发可通过XML进行配置并可通过PowerShell模块进行扩展的构建工具。我有一个XSD(http://download.crawler-lib.net/BuildTools/BuildConfig.xsd),它描述了开箱即用功能。一个扩展点是构建序列的工具:扩展XML模式xs:选择

<xs:element name="BuildSequence"> 
    <xs:annotation> 
     <xs:documentation>Performs a sequence of build tools to build the solution</xs:documentation> 
    </xs:annotation> 
    <xs:complexType> 
     <xs:choice maxOccurs="unbounded" minOccurs="0"> 
     <xs:element ref="bt:AppendText"/> 
     <xs:element ref="bt:Autover"/> 
     <xs:element ref="bt:Call"/> 
     <xs:element ref="bt:CopyFile"/> 
     <xs:element ref="bt:Download"/> 
     <xs:element ref="bt:DumpContext"/> 
     <xs:element ref="bt:FxCop"/> 
     <xs:element ref="bt:IntelliLock"/> 
     <xs:element ref="bt:MSBuild"/> 
     <xs:element ref="bt:NuGetPack"/> 
     <xs:element ref="bt:NuGetPush"/> 
     <xs:element ref="bt:NUnit"/> 
     <xs:element ref="bt:NuSpecUpdate"/> 
     <xs:element ref="bt:Powershell"/> 
     <xs:element ref="bt:RemoveFile"/> 
     <xs:element ref="bt:Upload"/> 
     <xs:element ref="bt:VerifyFile"/> 
     <xs:element ref="bt:Xslt"/> 
     <xs:element ref="bt:Zip"/> 
     </xs:choice> 
     <xs:attribute name="Name" type="xs:string" use="required"/> 
     <xs:attribute name="NewBuild" type="bt:boolean" use="optional"/> 
    </xs:complexType> 
    </xs:element> 

有人可能具有额外的PowerShell模块定义名为“WZ”一个生成步骤工具延伸此。所以在XML配置有可能是这应该是在像选择列表中的其他有效的元素:

<xs:element ref="custom:MyTool"/> 

如何延长使用一个额外的(custom.xsd)XSD文件这样一个定义?为了让自定义元素在Visual Studio中获得IntelliSense?

回答

0

考虑使用替代组。如果您的内容模型允许元素E,那么它也允许E的替代组中的任何元素;任何人都可以创建这样的元素(除非你阻止它),并且它可以自动变为可用,而无需更改您的内容模型。

+0

谢谢你的回答。看起来是一个很好的解决方案,但我不熟悉替代组的概念。你知道一个好的起点来学习它吗?问候汤姆 – 2014-08-31 13:01:01

+0

普里西拉瓦姆斯利的书是优秀的。 – 2014-08-31 17:46:27

+0

谢谢你的提示。 – 2014-08-31 22:22:49