Thanks for the PascalCase feature in 3.5 beta. It's really useful.
I found a problem when using PascalCase with XmlArray. Given the following XML:
message>
<actionseg>
<actioncode>CC</actioncode>
</actionseg>
<alternatelistseg>
<listrecord>
<prodcode>ARS</prodcode>
</listrecord>
</alternatelistseg>
</message>
And the following generated code (slighly changed):
public partial class Message
{
private MessageActionseg actionsegField;
private List<MessageListrecord> alternatelistsegField;
[System.Xml.Serialization.XmlElementAttribute("actionseg")]
public MessageActionseg Actionseg
{
get
{
if ((this.actionsegField == null))
{
this.actionsegField = new MessageActionseg();
}
return this.actionsegField;
}
set
{
this.actionsegField = value;
}
}
[System.Xml.Serialization.XmlArrayItemAttribute("listrecord", IsNullable = false)]
[System.Xml.Serialization.XmlElementAttribute("alternatelistseg")]
public List<MessageListrecord> Alternatelistseg
{
get
{
if ((this.alternatelistsegField == null))
{
this.alternatelistsegField = new List<MessageListrecord>();
}
return this.alternatelistsegField;
}
set
{
this.alternatelistsegField = value;
}
}
}
Xsd2Code will try to mix up XmlElementAttribute and XmlArrayItemAttribute which will fall into the following exception:
- XmlElement, XmlText, and XmlAnyElement cannot be used in conjunction with XmlAttribute, XmlAnyAttribute, XmlArray, or XmlArrayItem.
The right attributes should be:
[System.Xml.Serialization.XmlArrayItemAttribute("listrecord", IsNullable = false)]
[System.Xml.Serialization.XmlArray("alternatelistseg")]
Thanks for your help. Thanks for this tool.
Leo
I found a problem when using PascalCase with XmlArray. Given the following XML:
message>
<actionseg>
<actioncode>CC</actioncode>
</actionseg>
<alternatelistseg>
<listrecord>
<prodcode>ARS</prodcode>
</listrecord>
</alternatelistseg>
</message>
And the following generated code (slighly changed):
public partial class Message
{
private MessageActionseg actionsegField;
private List<MessageListrecord> alternatelistsegField;
[System.Xml.Serialization.XmlElementAttribute("actionseg")]
public MessageActionseg Actionseg
{
get
{
if ((this.actionsegField == null))
{
this.actionsegField = new MessageActionseg();
}
return this.actionsegField;
}
set
{
this.actionsegField = value;
}
}
[System.Xml.Serialization.XmlArrayItemAttribute("listrecord", IsNullable = false)]
[System.Xml.Serialization.XmlElementAttribute("alternatelistseg")]
public List<MessageListrecord> Alternatelistseg
{
get
{
if ((this.alternatelistsegField == null))
{
this.alternatelistsegField = new List<MessageListrecord>();
}
return this.alternatelistsegField;
}
set
{
this.alternatelistsegField = value;
}
}
}
Xsd2Code will try to mix up XmlElementAttribute and XmlArrayItemAttribute which will fall into the following exception:
- XmlElement, XmlText, and XmlAnyElement cannot be used in conjunction with XmlAttribute, XmlAnyAttribute, XmlArray, or XmlArrayItem.
The right attributes should be:
[System.Xml.Serialization.XmlArrayItemAttribute("listrecord", IsNullable = false)]
[System.Xml.Serialization.XmlArray("alternatelistseg")]
Thanks for your help. Thanks for this tool.
Leo