本文整理汇总了C#中System.Xml.Schema.XmlSchemaComplexType类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaComplexType类的具体用法?C# XmlSchemaComplexType怎么用?C# XmlSchemaComplexType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaComplexType类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaComplexType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSchema
public XmlSchemaElement GetSchema()
{
var type = new XmlSchemaComplexType();
type.Attributes.Add(new XmlSchemaAttribute
{
Name = "refValue",
Use = XmlSchemaUse.Required,
SchemaTypeName =
new XmlQualifiedName("positiveInteger", "http://www.w3.org/2001/XMLSchema")
});
type.Attributes.Add(new XmlSchemaAttribute
{
Name = "test",
Use = XmlSchemaUse.Optional,
SchemaTypeName =
new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
});
var restriction = new XmlSchemaSimpleTypeRestriction
{
BaseTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
};
restriction.Facets.Add(new XmlSchemaEnumerationFacet {Value = "years"});
restriction.Facets.Add(new XmlSchemaEnumerationFacet {Value = "weeks"});
restriction.Facets.Add(new XmlSchemaEnumerationFacet {Value = "days"});
var simpleType = new XmlSchemaSimpleType {Content = restriction};
type.Attributes.Add(new XmlSchemaAttribute
{
Name = "units",
Use = XmlSchemaUse.Required,
SchemaType = simpleType
});
type.Attributes.Add(new XmlSchemaAttribute
{
Name = "expressionLanguage",
Use = XmlSchemaUse.Optional,
SchemaTypeName =
new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")
});
var element = new XmlSchemaElement
{
Name = "dicom-age-less-than",
SchemaType = type
};
return element;
}
示例2: AndSchema
public static XmlSchemaElement AndSchema()
{
var type = new XmlSchemaComplexType();
var any = new XmlSchemaAny();
any.MinOccurs = 1;
any.MaxOccursString = "unbounded";
any.ProcessContents = XmlSchemaContentProcessing.Strict;
any.Namespace = "##local";
var sequence = new XmlSchemaSequence();
type.Particle = sequence;
sequence.Items.Add(any);
var attrib = new XmlSchemaAttribute();
attrib.Name = "expressionLanguage";
attrib.Use = XmlSchemaUse.Optional;
attrib.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
type.Attributes.Add(attrib);
attrib = new XmlSchemaAttribute();
attrib.Name = "failMessage";
attrib.Use = XmlSchemaUse.Optional;
attrib.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
type.Attributes.Add(attrib);
var element = new XmlSchemaElement();
element.Name = "and";
element.SchemaType = type;
return element;
}
示例3: CreateProtoComplexType
XObject[] CreateProtoComplexType(XmlSchemaComplexType complexType) {
if (complexType.ContentModel != null) {
if ((complexType.ContentModel as XmlSchemaSimpleContent) != null) {
return CreateProtoSimpleContent((complexType.ContentModel as XmlSchemaSimpleContent), complexType.BaseXmlSchemaType).ToArray();
} else if ((complexType.ContentModel as XmlSchemaComplexContent) != null) {
return CreateProtoComplexContent((complexType.ContentModel as XmlSchemaComplexContent), complexType.BaseXmlSchemaType).ToArray();
} else {
throw new Exception("not implemented");
}
} else {
var complexContentExt = new XmlSchemaComplexContentExtension();
if (complexType.BaseXmlSchemaType != null) {
complexContentExt.BaseTypeName = complexType.BaseXmlSchemaType.QualifiedName;
} else {
complexContentExt.BaseTypeName = null;
}
if (complexType.Attributes != null) {
foreach (var i in complexType.Attributes) {
complexContentExt.Attributes.Add(i);
}
}
complexContentExt.Particle = complexType.Particle;
var complexContent = new XmlSchemaComplexContent();
complexContent.Content = complexContentExt;
return CreateProtoComplexContent(complexContent, complexType.BaseXmlSchemaType).ToArray();
}
}
示例4: ChildComplexType
public ChildComplexType(XmlSchemaComplexType complexType, string elementName, string dotnetClassName, string nameSpace, XmlQualifiedName qname)
{
this.ComplexType = complexType;
this.ElementName = elementName;
this.DotnetClassName = dotnetClassName;
this.Namespace = nameSpace;
this.Qname = qname;
}
示例5: XmlSchemaComplexType
static XmlSchemaComplexType() {
anyType = new XmlSchemaComplexType();
anyType.SetContentType(XmlSchemaContentType.Mixed);
anyType.ElementDecl = SchemaElementDecl.CreateAnyTypeElementDecl();
XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
anyAttribute.BuildNamespaceList(null);
anyType.SetAttributeWildcard(anyAttribute);
anyType.ElementDecl.AnyAttribute = anyAttribute;
}
示例6: CreateXmlSchemaForIndicatorsInGroup
/// <summary>
/// Формируем XmlSchema для правильного отображения индикаторов группы в VGridControl
/// </summary>
/// <param name="elmList">названия всех по</param>
/// <returns>Возвращаем поток в который записана XmlSchema</returns>
public static MemoryStream CreateXmlSchemaForIndicatorsInGroup(List<string[]> elmList)
{
var xmlSchema = new XmlSchema();
// <xs:element name="root">
var elementRoot = new XmlSchemaElement();
xmlSchema.Items.Add(elementRoot);
elementRoot.Name = "root";
// <xs:complexType>
var complexType = new XmlSchemaComplexType();
elementRoot.SchemaType = complexType;
// <xs:choice minOccurs="0" maxOccurs="unbounded">
var choice = new XmlSchemaChoice();
complexType.Particle = choice;
choice.MinOccurs = 0;
choice.MaxOccursString = "unbounded";
// <xs:element name="record">
var elementRecord = new XmlSchemaElement();
choice.Items.Add(elementRecord);
elementRecord.Name = "record";
// <xs:complexType>
var complexType2 = new XmlSchemaComplexType();
elementRecord.SchemaType = complexType2;
// <xs:sequence>
var sequence = new XmlSchemaSequence();
complexType2.Particle = sequence;
foreach (var el in elmList)
{
var element = new XmlSchemaElement();
sequence.Items.Add(element);
element.Name = el[0];
element.SchemaTypeName = new XmlQualifiedName(el[1], "http://www.w3.org/2001/XMLSchema");
}
var schemaSet = new XmlSchemaSet();
schemaSet.Add(xmlSchema);
schemaSet.Compile();
XmlSchema compiledSchema = null;
foreach (XmlSchema schema1 in schemaSet.Schemas())
compiledSchema = schema1;
var nsmgr = new XmlNamespaceManager(new NameTable());
nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
var ms = new MemoryStream();
if (compiledSchema != null) compiledSchema.Write(ms, nsmgr);
ms.Position = 0;
return ms;
}
示例7: GetSchema
public XmlSchemaElement GetSchema()
{
var type = new XmlSchemaComplexType();
return new XmlSchemaElement
{
Name = OperatorTag,
SchemaType = type
};
}
示例8: GetStype
XmlSchemaComplexType GetStype ()
{
XmlSchemaSequence seq = new XmlSchemaSequence ();
seq.Items.Add (new XmlSchemaAny ());
XmlSchemaComplexType stype = new XmlSchemaComplexType ();
stype.Particle = seq;
return stype;
}
示例9: CheckComplexType
private void CheckComplexType(XmlQualifiedName typeName, XmlSchemaComplexType type)
{
if (type.IsAbstract)
{
ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, System.Runtime.Serialization.SR.GetString("AbstractTypeNotSupported"));
}
if (type.IsMixed)
{
ThrowTypeCannotBeImportedException(typeName.Name, typeName.Namespace, System.Runtime.Serialization.SR.GetString("MixedContentNotSupported"));
}
}
示例10: VisitComplexType
public virtual void VisitComplexType(XmlSchemaComplexType xmlSchemaComplexType)
{
// XmlSchemaParticle particle = xmlSchemaComplexType.ContentTypeParticle;
// VisitParticle(particle);
foreach (XmlSchemaObject attribute in xmlSchemaComplexType.Attributes)
{
Dispatch(attribute);
}
Dispatch(xmlSchemaComplexType.Particle);
}
示例11: Generator
public Generator(XmlSchemaComplexType xsCoxType,
Dictionary<string, string> elementRef,
Dictionary<string, string> includePath,
List<KeyValuePair<string, string>> elementSubstitutionRef,
Dictionary<string, XmlSchemaGroup> elementGroupRef)
{
this.includePath = includePath;
this.elementRef = elementRef;
this.elementSubstitutionRef = elementSubstitutionRef;
this.elementGroupRef = elementGroupRef;
this.setXsd(xsCoxType);
}
示例12: FixtureInit
public override void FixtureInit()
{
XmlSchemaCompletionCollection schemas = new XmlSchemaCompletionCollection();
schemas.Add(SchemaCompletion);
XmlSchemaCompletion xsdSchemaCompletion = new XmlSchemaCompletion(ResourceManager.ReadXsdSchema());
schemas.Add(xsdSchemaCompletion);
string xml = GetSchema();
int index = xml.IndexOf("type=\"text-type\"");
index = xml.IndexOf("text-type", index);
XmlSchemaDefinition schemaDefinition = new XmlSchemaDefinition(schemas, SchemaCompletion);
schemaComplexType = (XmlSchemaComplexType)schemaDefinition.GetSelectedSchemaObject(xml, index);
}
示例13: FixtureInit
public override void FixtureInit()
{
XmlSchemaCompletionDataCollection schemas = new XmlSchemaCompletionDataCollection();
schemas.Add(SchemaCompletionData);
XmlSchemaCompletionData xsdSchemaCompletionData = new XmlSchemaCompletionData(ResourceManager.GetXsdSchema());
schemas.Add(xsdSchemaCompletionData);
XmlCompletionDataProvider provider = new XmlCompletionDataProvider(schemas, xsdSchemaCompletionData, String.Empty);
string xml = GetSchema();
int index = xml.IndexOf("type=\"text-type\"");
index = xml.IndexOf("text-type", index);
schemaComplexType = (XmlSchemaComplexType)XmlView.GetSchemaObjectSelected(xml, index, provider, SchemaCompletionData);
}
示例14: AddExtensionAttributes
private void AddExtensionAttributes(ClassInfo classInfo, XmlSchemaComplexType complex)
{
if (complex.ContentModel == null || !(complex.ContentModel.Content is XmlSchemaSimpleContentExtension))
return;
var sce = complex.ContentModel.Content as XmlSchemaSimpleContentExtension;
if (sce.Attributes.Count == 0)
return;
AddAttributes(classInfo, sce.Attributes);
AddValueProperty(classInfo, sce);
}
示例15: Visit
protected override void Visit(XmlSchemaComplexType type)
{
if (type.QualifiedName.IsEmpty)
base.Visit(type);
else
{
if (!AddUsage(type))
return;
PushNamedObject(type);
base.Visit(type);
PopNamedObject();
}
}