Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ExportAttributeAccessor()

void System.Xml.Serialization.XmlSchemaExporter.ExportAttributeAccessor ( XmlSchemaComplexType type,
AttributeAccessor accessor,
bool valueTypeOptional,
string ns )
inlineprivate

Definition at line 708 of file XmlSchemaExporter.cs.

709 {
710 if (accessor == null)
711 {
712 return;
713 }
714 XmlSchemaObjectCollection attributes;
715 if (type.ContentModel != null)
716 {
717 if (type.ContentModel.Content is XmlSchemaComplexContentRestriction)
718 {
719 attributes = ((XmlSchemaComplexContentRestriction)type.ContentModel.Content).Attributes;
720 }
721 else if (type.ContentModel.Content is XmlSchemaComplexContentExtension)
722 {
723 attributes = ((XmlSchemaComplexContentExtension)type.ContentModel.Content).Attributes;
724 }
725 else
726 {
727 if (!(type.ContentModel.Content is XmlSchemaSimpleContentExtension))
728 {
729 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidContent, type.ContentModel.Content.GetType().Name));
730 }
731 attributes = ((XmlSchemaSimpleContentExtension)type.ContentModel.Content).Attributes;
732 }
733 }
734 else
735 {
736 attributes = type.Attributes;
737 }
738 if (accessor.IsSpecialXmlNamespace)
739 {
740 AddSchemaImport("http://www.w3.org/XML/1998/namespace", ns);
743 xmlSchemaAttribute.RefName = new XmlQualifiedName(accessor.Name, "http://www.w3.org/XML/1998/namespace");
744 attributes.Add(xmlSchemaAttribute);
745 return;
746 }
747 if (accessor.Any)
748 {
749 if (type.ContentModel == null)
750 {
752 return;
753 }
754 XmlSchemaContent content = type.ContentModel.Content;
756 {
759 }
760 else if (content is XmlSchemaComplexContentRestriction)
761 {
764 }
765 else if (type.ContentModel.Content is XmlSchemaSimpleContentExtension)
766 {
769 }
770 return;
771 }
774 if (!accessor.HasDefault && !valueTypeOptional && accessor.Mapping.TypeDesc.IsValueType)
775 {
777 }
779 if (accessor.Namespace == null || accessor.Namespace == ns)
780 {
782 if (xmlSchema == null)
783 {
785 }
786 else
787 {
788 xmlSchemaAttribute2.Form = ((accessor.Form != xmlSchema.AttributeFormDefault) ? accessor.Form : XmlSchemaForm.None);
789 }
790 attributes.Add(xmlSchemaAttribute2);
791 }
792 else
793 {
794 if (_attributes[accessor] == null)
795 {
800 }
803 xmlSchemaAttribute3.RefName = new XmlQualifiedName(accessor.Name, accessor.Namespace);
804 attributes.Add(xmlSchemaAttribute3);
805 AddSchemaImport(accessor.Namespace, ns);
806 }
807 if (accessor.Mapping is PrimitiveMapping)
808 {
809 PrimitiveMapping primitiveMapping = (PrimitiveMapping)accessor.Mapping;
810 if (primitiveMapping.IsList)
811 {
814 if (primitiveMapping.IsAnonymousType)
815 {
817 }
818 else
819 {
821 }
824 }
825 else if (primitiveMapping.IsAnonymousType)
826 {
828 }
829 else
830 {
832 }
833 }
834 else if (!(accessor.Mapping is SpecialMapping))
835 {
837 }
838 if (accessor.HasDefault)
839 {
841 }
842 }
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static string XmlInvalidContent
Definition SR.cs:1600
static string XmlInternalError
Definition SR.cs:1812
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7
void AddSchemaImport(string ns, string referencingNs)
XmlSchemaType ExportAnonymousPrimitiveMapping(PrimitiveMapping mapping)
static string ExportDefaultValue(TypeMapping mapping, object value)
void AddSchemaItem(XmlSchemaObject item, string ns, string referencingNs)
XmlQualifiedName ExportPrimitiveMapping(PrimitiveMapping mapping, string ns)

References System.Xml.Serialization.Mapping.Mapping(), System.Xml.Serialization.XmlSchemaExporter._attributes, System.Xml.Serialization.XmlSchemaExporter._schemas, System.Collections.Hashtable.Add(), System.Xml.Schema.XmlSchemaObjectCollection.Add(), System.Xml.Serialization.XmlSchemaExporter.AddSchemaImport(), System.Xml.Serialization.XmlSchemaExporter.AddSchemaItem(), System.Xml.Dictionary, System.Xml.Serialization.XmlSchemaExporter.ExportAnonymousPrimitiveMapping(), System.Xml.Serialization.XmlSchemaExporter.ExportDefaultValue(), System.Xml.Serialization.XmlSchemaExporter.ExportPrimitiveMapping(), System.SR.Format(), System.type, System.SR.XmlInternalError, and System.SR.XmlInvalidContent.

Referenced by System.Xml.Serialization.XmlSchemaExporter.ExportTypeMembers().