Beispiel #1
0
        public static DocumentSuggesterOptionsUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new DocumentSuggesterOptionsUnmarshaller();
            }

            return(instance);
        }
Beispiel #2
0
        public Suggester Unmarshall(XmlUnmarshallerContext context)
        {
            Suggester suggester     = new Suggester();
            int       originalDepth = context.CurrentDepth;
            int       targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("DocumentSuggesterOptions", targetDepth))
                    {
                        suggester.DocumentSuggesterOptions = DocumentSuggesterOptionsUnmarshaller.GetInstance().Unmarshall(context);

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



            return(suggester);
        }