コード例 #1
0
        public static SourceAttributeUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new SourceAttributeUnmarshaller();
            }

            return(instance);
        }
コード例 #2
0
        public IndexField Unmarshall(XmlUnmarshallerContext context)
        {
            IndexField indexField    = new IndexField();
            int        originalDepth = context.CurrentDepth;
            int        targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("IndexFieldName", targetDepth))
                    {
                        indexField.IndexFieldName = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("IndexFieldType", targetDepth))
                    {
                        indexField.IndexFieldType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("UIntOptions", targetDepth))
                    {
                        indexField.UIntOptions = UIntOptionsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("LiteralOptions", targetDepth))
                    {
                        indexField.LiteralOptions = LiteralOptionsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("TextOptions", targetDepth))
                    {
                        indexField.TextOptions = TextOptionsUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("SourceAttributes/member", targetDepth))
                    {
                        indexField.SourceAttributes.Add(SourceAttributeUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(indexField);
                }
            }



            return(indexField);
        }