EDN Admin
Well-known member
Hi,
Im generating a custom schema programmatically using XmlSchema and XmlSchemaSet objects but I dont know how to delete attributes such as minOccurs. Is this possible?
I can delete elements as follows:
<pre>foreach (XmlSchemaElement element in schema.Elements.Values)
{
if (element.Name.Equals("Product"))
{
schema.Items.Remove(element);
}
}[/code]
I can change elements attributes such as minOccurs as follows:<br/>
<pre>if (particle is XmlSchemaElement)
{
XmlSchemaElement element = particle as XmlSchemaElement;
element.MinOccurs = 1;
element.IsNillable = false;
}[/code]
but have no clue how to remove unwanted attributes via the XmlSchema API.
Ive used the following guide for accessing a schema programmatically:
Walking XmlSchema and XmlSchemaSet Objects
http://blogs.msdn.com/b/stan_kitsis/archive/2005/08/06/448572.aspx http://blogs.msdn.com/b/stan_kitsis/archive/2005/08/06/448572.aspx
Thanks
View the full article
Im generating a custom schema programmatically using XmlSchema and XmlSchemaSet objects but I dont know how to delete attributes such as minOccurs. Is this possible?
I can delete elements as follows:
<pre>foreach (XmlSchemaElement element in schema.Elements.Values)
{
if (element.Name.Equals("Product"))
{
schema.Items.Remove(element);
}
}[/code]
I can change elements attributes such as minOccurs as follows:<br/>
<pre>if (particle is XmlSchemaElement)
{
XmlSchemaElement element = particle as XmlSchemaElement;
element.MinOccurs = 1;
element.IsNillable = false;
}[/code]
but have no clue how to remove unwanted attributes via the XmlSchema API.
Ive used the following guide for accessing a schema programmatically:
Walking XmlSchema and XmlSchemaSet Objects
http://blogs.msdn.com/b/stan_kitsis/archive/2005/08/06/448572.aspx http://blogs.msdn.com/b/stan_kitsis/archive/2005/08/06/448572.aspx
Thanks
View the full article