Пример #1
0
        ArrayList _Types;                               // types of the columns

        public XmlDataReader(System.Data.CommandBehavior behavior, XmlConnection conn, XmlCommand cmd)
        {
            _xconn    = conn;
            _xcmd     = cmd;
            _behavior = behavior;

            // create an iterator to the selected rows
            _xpd        = new XPathDocument(_xcmd.Url);
            _xpn        = _xpd.CreateNavigator();
            _xpni       = _xpn.Select(_xcmd.RowsXPath);         // select the rows
            _NameSpaces = new ListDictionary();
            _Names      = new ArrayList();
            _Types      = new ArrayList();

            // Now determine the actual structure of the row depending on the command
            if (_xcmd.ColumnsXPath != null)
            {
                ColumnsSpecifiedInit();                                 // xpaths to all columns specified
            }
            else
            {
                _xcmd.ColumnsXPath = new ArrayList();                                   // xpath of all columns will simply be the name

                switch (_xcmd.Type)
                {
                case "both":
                    ColumnsAttributes();
                    ColumnsElements();
                    break;

                case "attributes":
                    ColumnsAttributes();
                    break;

                case "elements":
                    ColumnsElements();
                    break;
                }
            }
            _Data = new object[_Names.Count];                                   // allocate enough room for data

            if (_NameSpaces.Count > 0)
            {
                _nsmgr = new XmlNamespaceManager(new NameTable());
                foreach (string nsprefix in _NameSpaces.Keys)
                {
                    _nsmgr.AddNamespace(nsprefix, _NameSpaces[nsprefix] as string);                     // setup namespaces
                }
            }
            else
            {
                _nsmgr = null;
            }
        }
Пример #2
0
 public XmlCommand(XmlConnection conn)
 {
     _xc = conn;
 }