Exemplo n.º 1
0
        public static SequenceType Create(string name)
        {
            if (name == string.Empty || name == "empty-sequence()")
            {
                return(null);
            }

            XmlTypeCardinality cardinality = XmlTypeCardinality.One;

            if (name.EndsWith("?"))
            {
                cardinality = XmlTypeCardinality.ZeroOrOne;
                name        = name.Substring(1, name.Length - 1);
            }
            else if (name.EndsWith("+"))
            {
                cardinality = XmlTypeCardinality.OneOrMore;
                name        = name.Substring(1, name.Length - 1);
            }
            else if (name.EndsWith("*"))
            {
                cardinality = XmlTypeCardinality.ZeroOrMore;
                name        = name.Substring(1, name.Length - 1);
            }

            if (name.Equals("xs:AnyAtomicType"))
            {
                return(new SequenceType(XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.AnyAtomicType), cardinality, null));
            }

            if (name.Equals("item()"))
            {
                return(new SequenceType(XmlTypeCode.Item, cardinality));
            }

            if (name.Equals("node()"))
            {
                return(new SequenceType(XmlTypeCode.Node, cardinality));
            }

            string prefix;
            string localName;

            QNameParser.Split(name, out prefix, out localName);
            if (prefix != "xs")
            {
                throw new ArgumentException("name");
            }

            XmlSchemaType schemaType =
                XmlSchemaType.GetBuiltInSimpleType(new XmlQualifiedName(localName, XmlReservedNs.NsXs));

            if (schemaType == null)
            {
                throw new ArgumentException("name");
            }

            return(new SequenceType(schemaType, cardinality, null));
        }
Exemplo n.º 2
0
 public SequenceType(XmlSchemaType schemaType, XmlTypeCardinality cardinality, Type clrType)
 {
     TypeCode      = schemaType.TypeCode;
     SchemaType    = schemaType;
     Cardinality   = cardinality;
     ParameterType = clrType;
     IsNode        = TypeCodeIsNodeType(TypeCode);
     ItemType      = TypeCodeToItemType(TypeCode, SchemaType);
 }
Exemplo n.º 3
0
 public XQuerySequenceType(XmlTypeCode typeCode, XmlTypeCardinality cardinality, Type clrType)
     : this(typeCode, XmlQualifiedNameTest.Wildcard)
 {
     Cardinality = cardinality;
     ParameterType = clrType;
     IsNode = TypeCodeIsNodeType(TypeCode);
     if (TypeCode != XmlTypeCode.Item && !IsNode)
         SchemaType = XmlSchemaType.GetBuiltInSimpleType(TypeCode);
 }
Exemplo n.º 4
0
 public SequenceType(XmlTypeCode typeCode, XmlTypeCardinality cardinality, Type clrType)
     : this(typeCode, XmlQualifiedNameTest.Wildcard)
 {
     Cardinality   = cardinality;
     ParameterType = clrType;
     IsNode        = TypeCodeIsNodeType(TypeCode);
     if (TypeCode != XmlTypeCode.Item && !IsNode)
     {
         SchemaType = XmlSchemaType.GetBuiltInSimpleType(TypeCode);
     }
 }
Exemplo n.º 5
0
 public SequenceType(Type clrType, XmlTypeCardinality cardinality)
 {
     TypeCode = GetXmlTypeCode(clrType);
     if (TypeCode != XmlTypeCode.Item && !IsNode)
     {
         SchemaType = XmlSchemaType.GetBuiltInSimpleType(TypeCode);
     }
     ParameterType = clrType;
     Cardinality   = cardinality;
     IsNode        = TypeCodeIsNodeType(TypeCode);
     ItemType      = TypeCodeToItemType(TypeCode, SchemaType);
 }
Exemplo n.º 6
0
 public SequenceType(XmlTypeCode typeCode, XmlTypeCardinality cardinality)
     : this(typeCode, XmlQualifiedNameTest.Wildcard)
 {
     Cardinality = cardinality;
 }
Exemplo n.º 7
0
 public XQuerySequenceType(XmlTypeCode typeCode, XmlTypeCardinality cardinality)
     : this(typeCode, XmlQualifiedNameTest.Wildcard)
 {
     Cardinality = cardinality;
 }
Exemplo n.º 8
0
 public XQuerySequenceType(Type clrType, XmlTypeCardinality cardinality)
 {
     TypeCode = GetXmlTypeCode(clrType);
     if (TypeCode != XmlTypeCode.Item && !IsNode)
         SchemaType = XmlSchemaType.GetBuiltInSimpleType(TypeCode);
     ParameterType = clrType;
     Cardinality = cardinality;
     IsNode = TypeCodeIsNodeType(TypeCode);
     ItemType = TypeCodeToItemType(TypeCode, SchemaType);
 }
Exemplo n.º 9
0
 public XQuerySequenceType(XmlSchemaType schemaType, XmlTypeCardinality cardinality, Type clrType)
 {
     TypeCode = schemaType.TypeCode;
     SchemaType = schemaType;
     Cardinality = cardinality;
     ParameterType = clrType;
     IsNode = TypeCodeIsNodeType(TypeCode);
     ItemType = TypeCodeToItemType(TypeCode, SchemaType);
 }