Exemplo n.º 1
0
        /// <summary>
        /// Generates an DataSet from its RDL representation.
        /// </summary>
        /// <param name="reader">The <typeparamref name="XmlReader"/> stream from which the DataSet is deserialized</param>
        public void ReadXml(XmlReader reader)
        {
            if (reader.AttributeCount > 0)
            {
                _name = reader[Rdl.NAME];
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == Rdl.DATASET)
                {
                    break;
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    //--- Fields
                    if (reader.Name == Rdl.FIELDS)
                    {
                        if (_fields == null)
                        {
                            _fields = new FieldCollection();
                        }

                        ((IXmlSerializable)_fields).ReadXml(reader);
                    }

                    //--- Query
                    if (reader.Name == Rdl.QUERY)
                    {
                        if (_query == null)
                        {
                            _query = new Query();
                        }

                        ((IXmlSerializable)_query).ReadXml(reader);
                    }

                    //--- CaseSensitivity
                    if (reader.Name == Rdl.CASESENSITIVITY)
                    {
                        _caseSensitivity = (Sensitivity)Enum.Parse(typeof(Sensitivity), reader.ReadString());
                    }

                    //--- Collation
                    if (reader.Name == Rdl.COLLATION)
                    {
                        _collation = reader.ReadString();
                    }

                    //--- AccentSensitivity
                    if (reader.Name == Rdl.ACCENTSENSITIVITY)
                    {
                        _accentSensitivity = (Sensitivity)Enum.Parse(typeof(Sensitivity), reader.ReadString());
                    }

                    //--- KanatypeSensitivity
                    if (reader.Name == Rdl.KANATYPESENSITIVITY)
                    {
                        _kanatypeSensitivity = (Sensitivity)Enum.Parse(typeof(Sensitivity), reader.ReadString());
                    }

                    //--- WidthSensitivity
                    if (reader.Name == Rdl.CASESENSITIVITY)
                    {
                        _widthSensitivity = (Sensitivity)Enum.Parse(typeof(Sensitivity), reader.ReadString());
                    }

                    //--- Filters
                    if (reader.Name == Rdl.FILTERS && !reader.IsEmptyElement)
                    {
                        if (_filters == null)
                        {
                            _filters = new FilterCollection();
                        }

                        ((IXmlSerializable)_filters).ReadXml(reader);
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates an Grouping from its RDL representation.
        /// </summary>
        /// <param name="reader">The <typeparamref name="XmlReader"/> stream from which the Grouping is deserialized</param>
        public void ReadXml(XmlReader reader)
        {
            if (reader.AttributeCount > 0)
            {
                _name = reader[Rdl.NAME];
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == Rdl.GROUPING)
                {
                    break;
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    //--- Label
                    if (reader.Name == Rdl.LABEL)
                    {
                        if (_label == null)
                        {
                            _label = new Expression();
                        }

                        _label.Value = reader.ReadString();
                    }

                    //--- GroupExpressions
                    if (reader.Name == Rdl.GROUPEXPRESSIONS)
                    {
                        if (_groupExpressions == null)
                        {
                            _groupExpressions = new GroupExpressionCollection();
                        }

                        ((IXmlSerializable)_groupExpressions).ReadXml(reader);
                    }

                    //--- PageBreakAtStart
                    if (reader.Name == Rdl.PAGEBREAKATSTART)
                    {
                        _pageBreakAtStart = bool.Parse(reader.ReadString());
                    }

                    //--- PageBreakAtEnd
                    if (reader.Name == Rdl.PAGEBREAKATEND)
                    {
                        _pageBreakAtEnd = bool.Parse(reader.ReadString());
                    }

                    //--- CustomProperties
                    if (reader.Name == Rdl.CUSTOMPROPERTIES)
                    {
                        if (_customProperties == null)
                        {
                            _customProperties = new CustomPropertiesCollection();
                        }

                        ((IXmlSerializable)_customProperties).ReadXml(reader);
                    }

                    //--- Filters
                    if (reader.Name == Rdl.FILTERS)
                    {
                        if (_filters == null)
                        {
                            _filters = new FilterCollection();
                        }

                        ((IXmlSerializable)_filters).ReadXml(reader);
                    }

                    //--- Parent
                    if (reader.Name == Rdl.PARENT)
                    {
                        if (_parent == null)
                        {
                            _parent = new Expression();
                        }

                        _parent.Value = reader.ReadString();
                    }

                    //--- DataElementName
                    if (reader.Name == Rdl.DATAELEMENTNAME)
                    {
                        _dataElementName = reader.ReadString();
                    }

                    //--- DataCollectionName
                    if (reader.Name == Rdl.DATACOLLECTIONNAME)
                    {
                        _dataCollectionName = reader.ReadString();
                    }

                    //--- DataElementOutput
                    if (reader.Name == Rdl.DATAELEMENTOUTPUT)
                    {
                        _dataElementOutput = (GroupingDataElementOutput)Enum.Parse(typeof(GroupingDataElementOutput), reader.ReadString());
                    }
                }
            }
        }