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

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

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

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

                        continue;
                    }
                    if (context.TestExpression("SourceDataCopy", targetDepth))
                    {
                        sourceAttribute.SourceDataCopy = SourceDataUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("SourceDataTrimTitle", targetDepth))
                    {
                        sourceAttribute.SourceDataTrimTitle = SourceDataTrimTitleUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("SourceDataMap", targetDepth))
                    {
                        sourceAttribute.SourceDataMap = SourceDataMapUnmarshaller.GetInstance().Unmarshall(context);

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



            return(sourceAttribute);
        }