How to get the value of abstract property in xsd file
Good day.
In my project.
I want to get the abstract property value. During debuging. I can find the "elementDecl.isAbstract" is "true". But i don't know how to code.
<xsd:complexType name="Step.type" abstract="true"/>
My code to check the abstract method.
if (complexSequence == null && complexSchemaType.AttributeUses.Count == 0)
Could you help me to imporve the method with something like elementDecl.isAbstract ?
THANKS.
[Updated] my code below
public void AbstractTypeParse()
{
using (TextWriter writer = File.CreateText("D:\\learning\\TMP\\foo.cs"))
{
// Add the customer schema to a new XmlSchemaSet and compile it.
// Any schema validation warnings and errors encountered reading or
// compiling the schema are handled by the ValidationEventHandler delegate.
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.ValidationEventHandler += new ValidationEventHandler(ValidationCallback);
schemaSet.Add("http://www.w3.org/2001/XMLSchema", "D:\\learning\\TMP\\tmp.xsd");
schemaSet.Compile();
// Retrieve the compiled XmlSchema object from the XmlSchemaSet
// by iterating over the Schemas property.
XmlSchema customerSchema = null;
foreach (XmlSchema schema in schemaSet.Schemas())
{
customerSchema = schema;
}
foreach (XmlSchemaType SchemaType in customerSchema.SchemaTypes.Values)
{
// handle ComplexChildElement is simple type here
if (SchemaType.BaseXmlSchemaType.ToString() == "System.Xml.Schema.XmlSchemaComplexType")
{
// convert SchemaType to Complex SchemaType
XmlSchemaComplexType complexSchemaType = SchemaType as XmlSchemaComplexType;
开发者_如何学JAVA XmlSchemaSequence complexSequence = complexSchemaType.ContentTypeParticle as XmlSchemaSequence;
if (complexSequence == null && complexSchemaType.AttributeUses.Count == 0)
{
// Instered some code here ...
}
}
}
}
}
Thank you.
Looks like you're looking for XmlSchemaComplexType.IsAbstract
property
精彩评论