public FlatXmlDataReader(XmlReader reader, string dataElementPath, string[] fields, FlatXmlDataReaderOptions options)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (dataElementPath == null)
            {
                throw new ArgumentNullException("dataElementPath");
            }

            if (dataElementPath.Length == 0)
            {
                throw new ArgumentException("Parameter \"dataElementPath\" cannot be empty", "dataElementPath");
            }

            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }

            if (fields.Length == 0)
            {
                throw new ArgumentException("Parameter \"fields\" cannot be empty", "fields");
            }

            _xmlReader = reader;
            _fields = fields;
            _options = options;

            _dataElementPath = dataElementPath;
            _dataElementPathItems = SimpleXPathParser.Parse(dataElementPath);
            _dataElementPathItemIndex = _dataElementPathItems.Length - 1;
            _dataElementName = _dataElementPathItems[_dataElementPathItemIndex];

            MoveToDataElement();
        }
Exemple #2
0
        public FlatXmlDataReader(XmlReader reader, string dataElementPath, string[] fields, FlatXmlDataReaderOptions options)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (dataElementPath == null)
            {
                throw new ArgumentNullException("dataElementPath");
            }

            if (dataElementPath.Length == 0)
            {
                throw new ArgumentException("Parameter \"dataElementPath\" cannot be empty", "dataElementPath");
            }

            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }

            if (fields.Length == 0)
            {
                throw new ArgumentException("Parameter \"fields\" cannot be empty", "fields");
            }

            _xmlReader = reader;
            _fields    = fields;
            _options   = options;

            _dataElementPath          = dataElementPath;
            _dataElementPathItems     = SimpleXPathParser.Parse(dataElementPath);
            _dataElementPathItemIndex = _dataElementPathItems.Length - 1;
            _dataElementName          = _dataElementPathItems[_dataElementPathItemIndex];

            MoveToDataElement();
        }