本文整理汇总了C#中System.Xml.Serialization.XmlMembersMapping.CheckShallow方法的典型用法代码示例。如果您正苦于以下问题:C# XmlMembersMapping.CheckShallow方法的具体用法?C# XmlMembersMapping.CheckShallow怎么用?C# XmlMembersMapping.CheckShallow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Serialization.XmlMembersMapping
的用法示例。
在下文中一共展示了XmlMembersMapping.CheckShallow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportMembersMapping
/// <include file='doc\SoapCodeExporter.uex' path='docs/doc[@for="SoapCodeExporter.ExportMembersMapping"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping) {
xmlMembersMapping.CheckShallow();
CheckScope(xmlMembersMapping.Scope);
for (int i = 0; i < xmlMembersMapping.Count; i++) {
ExportElement((ElementAccessor)xmlMembersMapping[i].Accessor);
}
}
示例2: ExportMembersMapping
/// <include file='doc\XmlSchemaExporter.uex' path='docs/doc[@for="XmlSchemaExporter.ExportMembersMapping1"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping, bool exportEnclosingType) {
xmlMembersMapping.CheckShallow();
MembersMapping mapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping;
CheckScope(xmlMembersMapping.Scope);
if (mapping.HasWrapperElement && exportEnclosingType) {
ExportElement(xmlMembersMapping.Accessor);
}
else {
foreach (MemberMapping member in mapping.Members) {
if (member.Attribute != null)
throw new InvalidOperationException(Res.GetString(Res.XmlBareAttributeMember, member.Attribute.Name));
else if (member.Text != null)
throw new InvalidOperationException(Res.GetString(Res.XmlBareTextMember, member.Text.Name));
else if (member.Elements == null || member.Elements.Length == 0)
continue;
if (member.TypeDesc.IsArrayLike && !(member.Elements[0].Mapping is ArrayMapping))
throw new InvalidOperationException(Res.GetString(Res.XmlIllegalArrayElement, member.Elements[0].Name));
if (exportEnclosingType) {
ExportElement(member.Elements[0]);
}
else {
ExportMapping(member.Elements[0].Mapping, member.Elements[0].Namespace, member.Elements[0].Any);
}
}
}
ExportRootIfNecessary(xmlMembersMapping.Scope);
}
示例3: ExportMembersMapping
/// <include file='doc\XmlCodeExporter.uex' path='docs/doc[@for="XmlCodeExporter.ExportMembersMapping"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping)
{
xmlMembersMapping.CheckShallow();
CheckScope(xmlMembersMapping.Scope);
for (int i = 0; i < xmlMembersMapping.Count; i++)
{
AccessorMapping mapping = xmlMembersMapping[i].Mapping;
if (mapping.Xmlns == null)
{
if (mapping.Attribute != null)
{
ExportType(mapping.Attribute.Mapping, Accessor.UnescapeName(mapping.Attribute.Name), mapping.Attribute.Namespace, null, false);
}
if (mapping.Elements != null)
{
for (int j = 0; j < mapping.Elements.Length; j++)
{
ElementAccessor element = mapping.Elements[j];
ExportType(element.Mapping, Accessor.UnescapeName(element.Name), element.Namespace, null, false);
}
}
if (mapping.Text != null)
{
ExportType(mapping.Text.Mapping, Accessor.UnescapeName(mapping.Text.Name), mapping.Text.Namespace, null, false);
}
}
}
}
示例4: ExportTypeMapping
/// <include file='doc\XmlSchemaExporter.uex' path='docs/doc[@for="XmlSchemaExporter.ExportTypeMapping1"]/*' />
public XmlQualifiedName ExportTypeMapping(XmlMembersMapping xmlMembersMapping) {
xmlMembersMapping.CheckShallow();
CheckScope(xmlMembersMapping.Scope);
MembersMapping mapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping;
if (mapping.Members.Length == 1 && mapping.Members[0].Elements[0].Mapping is SpecialMapping) {
SpecialMapping special = (SpecialMapping)mapping.Members[0].Elements[0].Mapping;
XmlSchemaType type = ExportSpecialMapping(special, xmlMembersMapping.Accessor.Namespace, false, null);
if (type != null && type.Name != null && type.Name.Length > 0) {
type.Name = xmlMembersMapping.Accessor.Name;
AddSchemaItem(type, xmlMembersMapping.Accessor.Namespace, null);
}
ExportRootIfNecessary(xmlMembersMapping.Scope);
return (new XmlQualifiedName(xmlMembersMapping.Accessor.Name, xmlMembersMapping.Accessor.Namespace));
}
return null;
}
示例5: ExportMembersMapping
public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping, bool exportEnclosingType)
{
xmlMembersMapping.CheckShallow();
MembersMapping mapping = (MembersMapping) xmlMembersMapping.Accessor.Mapping;
this.CheckScope(xmlMembersMapping.Scope);
if (mapping.HasWrapperElement && exportEnclosingType)
{
this.ExportElement(xmlMembersMapping.Accessor);
}
else
{
foreach (MemberMapping mapping2 in mapping.Members)
{
if (mapping2.Attribute != null)
{
throw new InvalidOperationException(Res.GetString("XmlBareAttributeMember", new object[] { mapping2.Attribute.Name }));
}
if (mapping2.Text != null)
{
throw new InvalidOperationException(Res.GetString("XmlBareTextMember", new object[] { mapping2.Text.Name }));
}
if ((mapping2.Elements != null) && (mapping2.Elements.Length != 0))
{
if (mapping2.TypeDesc.IsArrayLike && !(mapping2.Elements[0].Mapping is ArrayMapping))
{
throw new InvalidOperationException(Res.GetString("XmlIllegalArrayElement", new object[] { mapping2.Elements[0].Name }));
}
if (exportEnclosingType)
{
this.ExportElement(mapping2.Elements[0]);
}
else
{
this.ExportMapping(mapping2.Elements[0].Mapping, mapping2.Elements[0].Namespace, mapping2.Elements[0].Any);
}
}
}
}
this.ExportRootIfNecessary(xmlMembersMapping.Scope);
}
示例6: ExportTypeMapping
public XmlQualifiedName ExportTypeMapping(XmlMembersMapping xmlMembersMapping)
{
xmlMembersMapping.CheckShallow();
this.CheckScope(xmlMembersMapping.Scope);
MembersMapping mapping = (MembersMapping) xmlMembersMapping.Accessor.Mapping;
if ((mapping.Members.Length != 1) || !(mapping.Members[0].Elements[0].Mapping is SpecialMapping))
{
return null;
}
SpecialMapping mapping2 = (SpecialMapping) mapping.Members[0].Elements[0].Mapping;
XmlSchemaType item = this.ExportSpecialMapping(mapping2, xmlMembersMapping.Accessor.Namespace, false, null);
if (((item != null) && (item.Name != null)) && (item.Name.Length > 0))
{
item.Name = xmlMembersMapping.Accessor.Name;
this.AddSchemaItem(item, xmlMembersMapping.Accessor.Namespace, null);
}
this.ExportRootIfNecessary(xmlMembersMapping.Scope);
return new XmlQualifiedName(xmlMembersMapping.Accessor.Name, xmlMembersMapping.Accessor.Namespace);
}