示例#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
        XPathNodeIterator _xpni; // the main iterator

        #endregion Fields

        #region Constructors

        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;
        }
示例#3
0
 public XmlCommand(XmlConnection conn)
 {
     _xc = conn;
 }
示例#4
0
        XmlConnection _xc; // connection we're running under

        #endregion Fields

        #region Constructors

        public XmlCommand(XmlConnection conn)
        {
            _xc = conn;
        }