System.Xml.XmlDataDocument.Load C# (CSharp) Method

Load() public method

Loads the XML document from the specified XmlReader.
public Load ( XmlReader reader ) : void
reader XmlReader
return void
        public override void Load(XmlReader reader)
        {
            if (FirstChild != null)
                throw new InvalidOperationException(SR.DataDom_MultipleLoad);

            try
            {
                _ignoreXmlEvents = true;

                // Unhook the DataRowCreatedSpecial listener, since we no longer base on the first created DataRow to do the Bind
                if (_fDataRowCreatedSpecial)
                    UnBindSpecialListeners();

                // We should NOT create DataRow objects when calling XmlDataDocument.CreateElement
                _fAssociateDataRow = false;
                // Foliation s/b disabled
                _isFoliationEnabled = false;

                //now if we load from file we need to set the ExpandEntity flag to ExpandEntities
                if (_bForceExpandEntity)
                {
                    Debug.Assert(reader is XmlTextReader);
                    ((XmlTextReader)reader).EntityHandling = EntityHandling.ExpandEntities;
                }
                base.Load(reader);
                BindForLoad();
            }
            finally
            {
                _ignoreXmlEvents = false;
                _isFoliationEnabled = true;
                _autoFoliationState = ElementState.StrongFoliation;
                _fAssociateDataRow = true;
            }
        }

Same methods

XmlDataDocument::Load ( Stream inStream ) : void
XmlDataDocument::Load ( TextReader txtReader ) : void
XmlDataDocument::Load ( string filename ) : void

Usage Example

示例#1
0
        public IDictionary<String, String> getLatLong(String zipCode)
        {
            XmlDataDocument doc = new XmlDataDocument();
            List<String> data = new List<String>();
            String url = "http://maps.googleapis.com/maps/api/geocode/xml?address=" + zipCode;
            doc.Load(url);

            XmlNodeList status = doc.GetElementsByTagName("status");
            String res_status = status[0].InnerText;
            if (!res_status.Equals("OK"))
            {
                data.Add("No Result");
            }

            XmlNodeList result = doc.GetElementsByTagName("result");
            XmlNodeList list = null,location = null;

            String latitude = null, longitude = null;

            for (int i = 0; i < result.Count; i++)
            {
                list = doc.GetElementsByTagName("geometry");
            }
            for (int i = 0; i < list.Count; i++)
            {
                location = doc.GetElementsByTagName("location");
            }

            latitude = location[0].SelectSingleNode("lat").InnerText;
            longitude = location[0].SelectSingleNode("lng").InnerText;
            return  getWeatherData(latitude,longitude);
        }
All Usage Examples Of System.Xml.XmlDataDocument::Load
XmlDataDocument