1+ using System . Xml ;
2+ using System . Xml . Schema ;
3+
4+ namespace XmlSchemaClassGenerator
5+ {
6+ public interface IXmlSchemaNode
7+ {
8+ string Name { get ; }
9+ string DefaultValue { get ; }
10+ string FixedValue { get ; }
11+ XmlSchemaForm Form { get ; }
12+ XmlQualifiedName QualifiedName { get ; }
13+ XmlQualifiedName RefName { get ; }
14+ XmlSchemaType SchemaType { get ; }
15+ XmlSchemaType NodeSchemaType { get ; }
16+ XmlQualifiedName SchemaTypeName { get ; }
17+
18+ XmlSchemaAnnotated Base { get ; }
19+ XmlSchemaForm FormDefault { get ; }
20+ }
21+
22+ public sealed class XmlSchemaAttributeEx : IXmlSchemaNode
23+ {
24+ private XmlSchemaAttributeEx ( XmlSchemaAttribute xs ) => Real = xs ;
25+
26+ public XmlSchemaAttribute Real { get ; }
27+
28+ public string Name => Real . Name ;
29+ public string DefaultValue => Real . DefaultValue ;
30+ public string FixedValue => Real . FixedValue ;
31+ public XmlSchemaForm Form => Real . Form ;
32+ public XmlQualifiedName QualifiedName => Real . QualifiedName ;
33+ public XmlQualifiedName RefName => Real . RefName ;
34+ public XmlQualifiedName SchemaTypeName => Real . SchemaTypeName ;
35+ public XmlSchemaSimpleType SchemaType => Real . SchemaType ;
36+ public XmlSchemaSimpleType AttributeSchemaType => Real . AttributeSchemaType ;
37+
38+ public XmlSchemaAnnotated Base => Real ;
39+
40+ public XmlSchemaForm FormDefault => Base . GetSchema ( ) . AttributeFormDefault ;
41+
42+ XmlSchemaType IXmlSchemaNode . SchemaType => SchemaType ;
43+
44+ XmlSchemaType IXmlSchemaNode . NodeSchemaType => AttributeSchemaType ;
45+
46+ public XmlSchemaUse Use => Real . Use ;
47+
48+ public static implicit operator XmlSchemaAttributeEx ( XmlSchemaAttribute xs ) => new ( xs ) ;
49+ public static implicit operator XmlSchemaAttribute ( XmlSchemaAttributeEx ex ) => ex . Real ;
50+ }
51+
52+ public sealed class XmlSchemaElementEx : IXmlSchemaNode
53+ {
54+ private XmlSchemaElementEx ( XmlSchemaElement xs ) => Real = xs ;
55+
56+ public XmlSchemaElement Real { get ; }
57+
58+ public string Name => Real . Name ;
59+ public string DefaultValue => Real . DefaultValue ;
60+ public string FixedValue => Real . FixedValue ;
61+ public XmlSchemaForm Form => Real . Form ;
62+ public XmlQualifiedName QualifiedName => Real . QualifiedName ;
63+ public XmlQualifiedName RefName => Real . RefName ;
64+ public XmlQualifiedName SchemaTypeName => Real . SchemaTypeName ;
65+ public XmlSchemaType SchemaType => Real . SchemaType ;
66+ public XmlSchemaType ElementSchemaType => Real . ElementSchemaType ;
67+
68+ public XmlSchemaAnnotated Base => Real ;
69+
70+ public XmlSchemaForm FormDefault => Base . GetSchema ( ) . ElementFormDefault ;
71+
72+ XmlSchemaType IXmlSchemaNode . SchemaType => SchemaType ;
73+
74+ XmlSchemaType IXmlSchemaNode . NodeSchemaType => ElementSchemaType ;
75+
76+ public bool IsNillable => Real . IsNillable ;
77+
78+ public static implicit operator XmlSchemaElementEx ( XmlSchemaElement xs ) => new ( xs ) ;
79+ public static implicit operator XmlSchemaElement ( XmlSchemaElementEx ex ) => ex . Real ;
80+ }
81+ }
0 commit comments