Xsd abstract usage?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
If you create a new xml document document in VS2010 using this xml:

<div style="color:black; background-color:white
<pre><span style="color:blue <?<span style="color:#a31515 xml <span style="color:red version<span style="color:blue =<span style="color:black "<span style="color:blue 1.0<span style="color:black " <span style="color:red encoding<span style="color:blue =<span style="color:black "<span style="color:blue utf-8<span style="color:black " <span style="color:blue ?>
<span style="color:blue <<span style="color:#a31515 Project <span style="color:red xmlns<span style="color:blue =<span style="color:black "<span style="color:blue http://schemas.microsoft.com/developer/msbuild/2003<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ItemGroup<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 SolutionFiles <span style="color:red Include<span style="color:blue =<span style="color:black "<span style="color:blue Repository.cmd<span style="color:black " <span style="color:blue />
<span style="color:blue </<span style="color:#a31515 ItemGroup<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Target <span style="color:red Name<span style="color:blue =<span style="color:black "<span style="color:blue CopyFiles<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Copy <span style="color:red SourceFiles<span style="color:blue =<span style="color:black "<span style="color:blue @(SolutionFiles)<span style="color:black " <span style="color:red DestinationFolder<span style="color:blue =<span style="color:black "<span style="color:blue $(OutDir)<span style="color:black " <span style="color:blue />
<span style="color:blue </<span style="color:#a31515 Target<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Project<span style="color:blue >

[/code]


You will get a warning about the children of "ItemGroup". This element is defined in "Microsoft.Build.Core.xsd" file (on my pc its located here: "C:Program Files (x86)Microsoft Visual Studio 10.0xmlSchemas1033MSBuild").
If you look to that xsd, youll see that the problem is with the definition of the "Item" type: <xs:element name="Item" type="msb:SimpleItemType" abstract="true"/>. Now Im not familiar with the "abstract" attribute. Searching the matter doesnt reveal
how that attribute can do the task its set up for.
Basically, the elements under "ItemGroup" could be anything. The "SolutionFiles" element from above xml is my own definition. And that is how it should be. Can anyone see how the xsd could be changed to allow
any elements under "ItemGroup"?
Edit: <br/>
It will work if I include a substitution like this:

<pre lang="x-xml <xs:element name="SolutionFiles" type="msb:SimpleItemType" substitutionGroup="msb:Item" ></xs:element>
[/code]

But it would be nice if I didnt have top include my own schema in this context. Is it possible to avoid the substitutionGroup definition?
-- <br/>
Werner

<br/>

View the full article
 
Back
Top