M
martin.zarate
Hey, I'm just trying out the XSD.exe tool and have run into a problem -
it doesn't generate classes for all the members. For example, here's
my call:
D:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>XSD
D:\projects\Repricer
\Repricer\bin\Debug\Repricer.exe
/outputdir:\projects\Repricer\Repricer /t:Mut
ator /t:Source
Now, one of the classes listed there is "Source". The class "source"
is included at the bottom of this post. The problem is that source has
three arrays, and only the "Includes" attribute is included in the XSD
- see below:
<xs:complexType name="Source">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Includes"
type="ArrayOfIncludedDirectory" />
</xs:sequence>
<xs:attribute name="Path" type="xs:string" />
<xs:attribute name="Name" type="xs:string" />
<xs:attribute name="Hidden" type="xs:boolean" use="required" />
</xs:complexType>
Is there some kind of cues I need to give XSD.EXE to actually get _all_
of the members?
[System.Xml.Serialization.XmlTypeAttribute(Namespace =
"http://pxtl.livejournal.com/")]
public class Source : IEnumerable<Source>
{
[XmlAttribute()]
public string Path;
[XmlAttribute()]
public string Name;
[XmlAttribute()]
public bool Hidden = false;
[XmlArrayAttribute()]
[XmlArrayItem("Include", typeof(IncludedDirectory))]
public IncludedDirectory[] Includes;
[XmlArrayAttribute()]
[XmlArrayItem("Source", typeof(Source))]
public Source[] AdditionalSources;
[XmlArrayAttribute()]
[XmlArrayItem("TagChange", typeof(TagChange))]
[XmlArrayItem("BuildListChange", typeof(BuildListChange))]
public ChangeModule[] ChangeModules;
[XmlArrayAttribute()]
[XmlArrayItem("MergeBuildLists")]
[XmlArrayItem("MergeSides")]
[XmlArrayItem("MergeMoveInfo")]
[XmlArrayItem("MergeFiles")]
public MergeModule[] MergeModules;
public void MergeInto(DirectoryContainer parentSource)
{
DirectoryContainer thisSource =
DirectoryContainer.ConstructDirectoryContainer(this);
foreach (Source additionalSource in this.AdditionalSources)
{
additionalSource.MergeInto(thisSource);
}
foreach (ChangeModule module in ChangeModules)
{
module.Execute(thisSource);
}
foreach (MergeModule module in MergeModules)
{
module.Execute(parentSource, thisSource);
}
}
#region IEnumerable<Source> Members
public IEnumerator<Source> GetEnumerator()
{
yield return this;
foreach(Source s in AdditionalSources)
{
yield return s;
}
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator
System.Collections.IEnumerable.GetEnumerator()
{
foreach (Source s in this)
{
yield return s;
}
}
#endregion
}
it doesn't generate classes for all the members. For example, here's
my call:
D:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>XSD
D:\projects\Repricer
\Repricer\bin\Debug\Repricer.exe
/outputdir:\projects\Repricer\Repricer /t:Mut
ator /t:Source
Now, one of the classes listed there is "Source". The class "source"
is included at the bottom of this post. The problem is that source has
three arrays, and only the "Includes" attribute is included in the XSD
- see below:
<xs:complexType name="Source">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="Includes"
type="ArrayOfIncludedDirectory" />
</xs:sequence>
<xs:attribute name="Path" type="xs:string" />
<xs:attribute name="Name" type="xs:string" />
<xs:attribute name="Hidden" type="xs:boolean" use="required" />
</xs:complexType>
Is there some kind of cues I need to give XSD.EXE to actually get _all_
of the members?
[System.Xml.Serialization.XmlTypeAttribute(Namespace =
"http://pxtl.livejournal.com/")]
public class Source : IEnumerable<Source>
{
[XmlAttribute()]
public string Path;
[XmlAttribute()]
public string Name;
[XmlAttribute()]
public bool Hidden = false;
[XmlArrayAttribute()]
[XmlArrayItem("Include", typeof(IncludedDirectory))]
public IncludedDirectory[] Includes;
[XmlArrayAttribute()]
[XmlArrayItem("Source", typeof(Source))]
public Source[] AdditionalSources;
[XmlArrayAttribute()]
[XmlArrayItem("TagChange", typeof(TagChange))]
[XmlArrayItem("BuildListChange", typeof(BuildListChange))]
public ChangeModule[] ChangeModules;
[XmlArrayAttribute()]
[XmlArrayItem("MergeBuildLists")]
[XmlArrayItem("MergeSides")]
[XmlArrayItem("MergeMoveInfo")]
[XmlArrayItem("MergeFiles")]
public MergeModule[] MergeModules;
public void MergeInto(DirectoryContainer parentSource)
{
DirectoryContainer thisSource =
DirectoryContainer.ConstructDirectoryContainer(this);
foreach (Source additionalSource in this.AdditionalSources)
{
additionalSource.MergeInto(thisSource);
}
foreach (ChangeModule module in ChangeModules)
{
module.Execute(thisSource);
}
foreach (MergeModule module in MergeModules)
{
module.Execute(parentSource, thisSource);
}
}
#region IEnumerable<Source> Members
public IEnumerator<Source> GetEnumerator()
{
yield return this;
foreach(Source s in AdditionalSources)
{
yield return s;
}
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator
System.Collections.IEnumerable.GetEnumerator()
{
foreach (Source s in this)
{
yield return s;
}
}
#endregion
}