本文整理汇总了C#中System.Xml.Schema.XmlSchemaComplexContentExtension类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaComplexContentExtension类的具体用法?C# XmlSchemaComplexContentExtension怎么用?C# XmlSchemaComplexContentExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaComplexContentExtension类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaComplexContentExtension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
protected override void Visit(XmlSchemaComplexContentExtension extension)
{
var baseType = _schemaSetManager.SchemaSet.GlobalTypes[extension.BaseTypeName] as XmlSchemaComplexType;
if (baseType != null)
{
if (baseType.ContentType == XmlSchemaContentType.ElementOnly ||
baseType.ContentType == XmlSchemaContentType.Mixed)
{
if (extension.Particle == null)
{
Traverse(baseType);
}
else
{
PushNode(ChildType.Sequence, extension, null);
Traverse(baseType);
Traverse(extension.Particle);
PopNode();
}
return;
}
}
if (extension.Particle != null)
Traverse(extension.Particle);
}
示例2: 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();
}
}
示例3: AssertCompiledComplexContentExtension
public static void AssertCompiledComplexContentExtension (XmlSchemaComplexContentExtension xccx,
int attributeCount, bool hasAnyAttribute, XmlQualifiedName baseTypeName)
{
Assert.IsNotNull (xccx);
Assert.AreEqual (attributeCount, xccx.Attributes.Count);
Assert.AreEqual (hasAnyAttribute, xccx.AnyAttribute != null);
Assert.AreEqual (baseTypeName, xccx.BaseTypeName);
Assert.IsNotNull (xccx.Particle);
}
示例4: AssertCompiledComplexContentExtension
protected void AssertCompiledComplexContentExtension (XmlSchemaComplexContentExtension xccx,
int attributeCount, bool hasAnyAttribute, XmlQualifiedName baseTypeName)
{
AssertNotNull (xccx);
AssertEquals (attributeCount, xccx.Attributes.Count);
AssertEquals (hasAnyAttribute, xccx.AnyAttribute != null);
AssertEquals (baseTypeName, xccx.BaseTypeName);
AssertNotNull (xccx.Particle);
}
示例5: Write42_XmlSchemaComplexContentExtension
void Write42_XmlSchemaComplexContentExtension(XmlSchemaComplexContentExtension o) {
if ((object)o == null) return;
WriteStartElement("extension");
WriteAttribute(@"id", @"", ((System.String)[email protected]));
WriteAttributes((XmlAttribute[])[email protected], o);
if ([email protected]){
WriteAttribute(@"base", @"", [email protected]);
}
Write5_XmlSchemaAnnotation((XmlSchemaAnnotation)[email protected]);
if ([email protected] is XmlSchemaSequence) {
Write54_XmlSchemaSequence((XmlSchemaSequence)[email protected]);
}
else if ([email protected] is XmlSchemaGroupRef) {
Write55_XmlSchemaGroupRef((XmlSchemaGroupRef)[email protected]);
}
else if ([email protected] is XmlSchemaChoice) {
Write52_XmlSchemaChoice((XmlSchemaChoice)[email protected]);
}
else if ([email protected] is XmlSchemaAll) {
Write43_XmlSchemaAll((XmlSchemaAll)[email protected]);
}
WriteSortedItems(o.Attributes);
Write33_XmlSchemaAnyAttribute((XmlSchemaAnyAttribute)[email protected]);
WriteEndElement();
}
示例6: ExportStructMapping
private XmlQualifiedName ExportStructMapping(StructMapping mapping, string ns, XmlSchemaElement element)
{
if (mapping.TypeDesc.IsRoot)
{
this.needToExportRoot = true;
return XmlQualifiedName.Empty;
}
if (mapping.IsAnonymousType)
{
if (this.references[mapping] != null)
{
throw new InvalidOperationException(Res.GetString("XmlCircularReference2", new object[] { mapping.TypeDesc.Name, "AnonymousType", "false" }));
}
this.references[mapping] = mapping;
}
XmlSchemaComplexType item = (XmlSchemaComplexType) this.types[mapping];
if (item == null)
{
if (!mapping.IncludeInSchema)
{
throw new InvalidOperationException(Res.GetString("XmlCannotIncludeInSchema", new object[] { mapping.TypeDesc.Name }));
}
this.CheckForDuplicateType(mapping, mapping.Namespace);
item = new XmlSchemaComplexType();
if (!mapping.IsAnonymousType)
{
item.Name = mapping.TypeName;
this.AddSchemaItem(item, mapping.Namespace, ns);
this.types.Add(mapping, item);
}
item.IsAbstract = mapping.TypeDesc.IsAbstract;
bool isOpenModel = mapping.IsOpenModel;
if ((mapping.BaseMapping != null) && mapping.BaseMapping.IncludeInSchema)
{
if (mapping.BaseMapping.IsAnonymousType)
{
throw new InvalidOperationException(Res.GetString("XmlAnonymousBaseType", new object[] { mapping.TypeDesc.Name, mapping.BaseMapping.TypeDesc.Name, "AnonymousType", "false" }));
}
if (mapping.HasSimpleContent)
{
XmlSchemaSimpleContent content = new XmlSchemaSimpleContent();
XmlSchemaSimpleContentExtension extension = new XmlSchemaSimpleContentExtension {
BaseTypeName = this.ExportStructMapping(mapping.BaseMapping, mapping.Namespace, null)
};
content.Content = extension;
item.ContentModel = content;
}
else
{
XmlSchemaComplexContentExtension extension2 = new XmlSchemaComplexContentExtension {
BaseTypeName = this.ExportStructMapping(mapping.BaseMapping, mapping.Namespace, null)
};
XmlSchemaComplexContent content2 = new XmlSchemaComplexContent {
Content = extension2,
IsMixed = XmlSchemaImporter.IsMixed((XmlSchemaComplexType) this.types[mapping.BaseMapping])
};
item.ContentModel = content2;
}
isOpenModel = false;
}
this.ExportTypeMembers(item, mapping.Members, mapping.TypeName, mapping.Namespace, mapping.HasSimpleContent, isOpenModel);
this.ExportDerivedMappings(mapping);
if (mapping.XmlnsMember != null)
{
this.AddXmlnsAnnotation(item, mapping.XmlnsMember.Name);
}
}
else
{
this.AddSchemaImport(mapping.Namespace, ns);
}
if (mapping.IsAnonymousType)
{
this.references[mapping] = null;
if (element != null)
{
element.SchemaType = item;
}
return XmlQualifiedName.Empty;
}
XmlQualifiedName name = new XmlQualifiedName(item.Name, mapping.Namespace);
if (element != null)
{
element.SchemaTypeName = name;
}
return name;
}
示例7: GetAttributeCompletion
XmlCompletionItemCollection GetAttributeCompletion(XmlSchemaComplexContentExtension extension, XmlNamespaceCollection namespacesInScope)
{
XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
completionItems.AddRange(GetAttributeCompletion(extension.Attributes, namespacesInScope));
completionItems.AddRange(GetBaseComplexTypeAttributeCompletion(extension.BaseTypeName, namespacesInScope));
return completionItems;
}
示例8: FindAttribute
XmlSchemaAttribute FindAttribute(XmlSchemaComplexContentExtension extension, string name)
{
return FindAttribute(extension.Attributes, name);
}
示例9: CreateForEachElement
/// <summary>
/// Creates an element representing a conditional "ForEach" block, which recursively contains another type
/// </summary>
/// <param name="InnerType">The base type for the foreach block to contain</param>
/// <returns>New schema element for the block</returns>
static XmlSchemaElement CreateForEachElement(ScriptSchemaStandardType InnerType)
{
XmlSchemaComplexContentExtension Extension = new XmlSchemaComplexContentExtension();
Extension.BaseTypeName = GetQualifiedTypeName(InnerType);
Extension.Attributes.Add(CreateSchemaAttribute("Name", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Required));
Extension.Attributes.Add(CreateSchemaAttribute("Values", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Required));
Extension.Attributes.Add(CreateSchemaAttribute("If", ScriptSchemaStandardType.BalancedString, XmlSchemaUse.Optional));
XmlSchemaComplexContent ContentModel = new XmlSchemaComplexContent();
ContentModel.Content = Extension;
XmlSchemaComplexType SchemaType = new XmlSchemaComplexType();
SchemaType.ContentModel = ContentModel;
XmlSchemaElement Element = new XmlSchemaElement();
Element.Name = "ForEach";
Element.SchemaType = SchemaType;
return Element;
}
示例10: Visit
protected override void Visit(XmlSchemaComplexContentExtension extension)
{
ProcessExtension(extension.BaseTypeName, extension.Attributes, extension.AnyAttribute);
}
示例11: GetAttributeCompletionData
XmlCompletionDataCollection GetAttributeCompletionData(XmlSchemaComplexContentExtension extension)
{
XmlCompletionDataCollection data = new XmlCompletionDataCollection();
data.AddRange(GetAttributeCompletionData(extension.Attributes));
XmlSchemaComplexType baseComplexType = FindNamedType(schema, extension.BaseTypeName);
if (baseComplexType != null) {
data.AddRange(GetAttributeCompletionData(baseComplexType));
}
return data;
}
示例12: WriteComplexSchemaType
/// <summary>
/// Handle derivation by extension.
/// If type is null, it'll create a new complexType
/// with an XmlAny node in its sequence child node.
/// </summary>
public XmlSchemaType WriteComplexSchemaType (Type type)
{
//
// Recursively generate schema for all parent types
//
if (type != null && type.BaseType == typeof (object))
return WriteSchemaType (type);
XmlSchemaComplexType complexType = new XmlSchemaComplexType ();
XmlSchemaSequence sequence;
XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension ();
XmlSchemaComplexContent content = new XmlSchemaComplexContent ();
complexType.ContentModel = content;
content.Content = extension;
XmlSchemaType baseSchemaType = WriteSchemaType (type.BaseType);
complexType.Name = type.Name;
FieldInfo [] fields = type.GetFields (flags);
PropertyInfo [] properties = type.GetProperties (flags);
try {
sequence = PopulateSequence (fields, properties);
if (attributes != null) {
foreach (object o in attributes) {
MemberInfo member = (MemberInfo) o;
Type attribute_type = (Type) attributes [o];
complexType.Attributes.Add (WriteSchemaAttribute (member, attribute_type));
}
}
} catch (ArgumentException e) {
throw new ArgumentException (String.Format ("There is an error in '{0}'\n\t{1}", type.Name, e.Message));
}
extension.BaseTypeName = new XmlQualifiedName (baseSchemaType.Name);
extension.Particle = sequence;
generatedSchemaTypes.Add (type.FullName, complexType);
return complexType;
}
示例13: Check
public override void Check (ConformanceCheckContext ctx, XmlSchemaComplexContentExtension value)
{
CheckSchemaQName (ctx, value, value.BaseTypeName);
if (value.BaseTypeName.Namespace == "http://schemas.xmlsoap.org/soap/encoding/" && value.BaseTypeName.Name == "Array")
ctx.ReportRuleViolation (value, BasicProfileRules.R2110);
}
示例14: ExportStructMapping
XmlQualifiedName ExportStructMapping(StructMapping mapping, string ns) {
if (mapping.TypeDesc.IsRoot) return ExportRootMapping(mapping);
XmlSchemaComplexType type = (XmlSchemaComplexType)types[mapping];
if (type == null) {
if (!mapping.IncludeInSchema) throw new InvalidOperationException(Res.GetString(Res.XmlSoapCannotIncludeInSchema, mapping.TypeDesc.Name));
CheckForDuplicateType(mapping.TypeName, mapping.Namespace);
type = new XmlSchemaComplexType();
type.Name = mapping.TypeName;
types.Add(mapping, type);
AddSchemaItem(type, mapping.Namespace, ns);
type.IsAbstract = mapping.TypeDesc.IsAbstract;
if (mapping.BaseMapping != null && mapping.BaseMapping.IncludeInSchema) {
XmlSchemaComplexContentExtension extension = new XmlSchemaComplexContentExtension();
extension.BaseTypeName = ExportStructMapping(mapping.BaseMapping, mapping.Namespace);
XmlSchemaComplexContent model = new XmlSchemaComplexContent();
model.Content = extension;
type.ContentModel = model;
}
ExportTypeMembers(type, mapping.Members, mapping.Namespace);
ExportDerivedMappings(mapping);
}
else {
AddSchemaImport(mapping.Namespace, ns);
}
return new XmlQualifiedName(type.Name, mapping.Namespace);
}
示例15: Check
public virtual void Check (ConformanceCheckContext ctx, XmlSchemaComplexContentExtension value) {}