当前位置: 首页>>代码示例>>C#>>正文


C# System.Xml.XmlTextReader.ReadInnerXml方法代码示例

本文整理汇总了C#中System.Xml.XmlTextReader.ReadInnerXml方法的典型用法代码示例。如果您正苦于以下问题:C# System.Xml.XmlTextReader.ReadInnerXml方法的具体用法?C# System.Xml.XmlTextReader.ReadInnerXml怎么用?C# System.Xml.XmlTextReader.ReadInnerXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlTextReader的用法示例。


在下文中一共展示了System.Xml.XmlTextReader.ReadInnerXml方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OAI_LIST

        public OAI_LIST(string sXML, ref Object objHandler)
        {
            System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(sXML, System.Xml.XmlNodeType.Element, null);
            while (reader.Read())
            {
                if (reader.Name == "setSpec")
                {
                    setSpec = reader.ReadString();
                }
                else if (reader.Name == "setName")
                {
                    setName = reader.ReadString();
                }
                else if (reader.Name == "setDescription")
                {
                    Type theHandlerType = Type.GetType(objHandler.ToString());
                    Object[] tobject = new object[1];
                    tobject[0] = reader.ReadInnerXml();

                    description = theHandlerType.InvokeMember("", BindingFlags.DeclaredOnly |
                        BindingFlags.Public | BindingFlags.NonPublic |
                        BindingFlags.Instance | BindingFlags.CreateInstance, null, null, tobject);
                }
            }
        }
开发者ID:rodricios,项目名称:OaiHarvestAndStore,代码行数:25,代码来源:oai.cs

示例2: OAI_DC

        public OAI_DC(string sXML)
        {
            System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(sXML, System.Xml.XmlNodeType.Element, null);
            while (reader.Read() && reader.Name != "oai_dc:dc" && reader.Name != "oaidc:dc") ;  // Keep reading until finding oia_dc

            string oiaDCxml = reader.ReadInnerXml();

            reader = new System.Xml.XmlTextReader(oiaDCxml, System.Xml.XmlNodeType.Element, null);

            while (reader.Read())
            {
                string metadata = reader.Name.Replace("dc:", "");  // Remove optional dc:
                switch (metadata)
                {
                    case "title":
                        title.Add(reader.ReadString());
                        break;
                    case "creator":
                        creator.Add(reader.ReadString());
                        break;
                    case "subject":
                        subject.Add(reader.ReadString());
                        break;
                    case "description":
                        description.Add(reader.ReadString());
                        break;
                    case "publisher":
                        publisher.Add(reader.ReadString());
                        break;
                    case "contributor":
                        contributor.Add(reader.ReadString());
                        break;
                    case "date":
                        date.Add(reader.ReadString());
                        break;
                    case "type":
                        type.Add(reader.ReadString());
                        break;
                    case "format":
                        format.Add(reader.ReadString());
                        break;
                    case "identifier":
                        identifier.Add(reader.ReadString());
                        break;
                    case "source":
                        source.Add(reader.ReadString());
                        break;
                    case "language":
                        language.Add(reader.ReadString());
                        break;
                    case "relation":
                        relation.Add(reader.ReadString());
                        break;
                    case "coverage":
                        coverage.Add(reader.ReadString());
                        break;
                    case "rights":
                        rights.Add(reader.ReadString());
                        break;
                    default:
                        break;
                }
            } // end while
        }
开发者ID:rodricios,项目名称:OaiHarvestAndStore,代码行数:64,代码来源:oai.cs

示例3: ListSets

        public ListSet ListSets(ResumptionToken objToken, ref Object objHandler)
        {
            System.IO.Stream objStream;
            OAI_LIST objRecord;
            ListSet objList = new ListSet();
            ResumptionToken myToken;
            string tmp = "";
            System.Net.HttpWebRequest wr;
            System.Xml.XmlTextReader rd;

            if (objToken == null)
            {
                prequestURL = baseURL + "?verb=ListSets";
            }
            else
            {
                prequestURL = baseURL + "?verb=ListSets&resumptionToken=" + objToken.resumptionToken;
                //This is where we handle the resumptionToken
            }
            //======================================================
            // If you wanted to support additional metadata formats,
            // you would just need to have additional handlers.
            //======================================================

            try
            {
                wr = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(prequestURL);
                wr.UserAgent = cUserAgent;
                System.Net.WebResponse response = wr.GetResponse();
                objStream = response.GetResponseStream();
                System.IO.StreamReader reader = new System.IO.StreamReader(objStream);
                prawXML = reader.ReadToEnd();
                reader.Close();
                rd = new System.Xml.XmlTextReader(prawXML, System.Xml.XmlNodeType.Document, null);
            }
            catch (Exception e)
            {
                error.errorName = e.ToString();
                error.errorDescription = e.Message + "\n<br>Unable to connect to " + baseURL;
                return null;
            }

            while (rd.Read())
            {
                if (rd.NodeType == System.Xml.XmlNodeType.Element)
                {
                    if (rd.Name == "responseDate")
                    {
                        presponseDate = rd.ReadString();
                    }
                    else if (rd.Name == "ListSets")
                    {
                        //while (rd.Read())
                        do
                        {
                            if (rd.Name == "set")
                            {
                                objRecord = new OAI_LIST(rd.ReadInnerXml(), ref objHandler);
                                objList.listset.Add(objRecord);
                                //return objRecord;
                            }
                            else if (rd.Name == "resumptionToken")
                            {
                                tmp = rd.ReadOuterXml();
                                myToken = new ResumptionToken(tmp);
                                objList.token = myToken;
                            }
                            else rd.Read(); // Added the Read() and will never occur with the ReadInnerXml()

                        } while (rd.Name != "ListSets"); // loop
                    }
                    else if (rd.Name == "error")
                    {
                        error.errorName = rd.GetAttribute("code");
                        error.errorDescription = rd.ReadString();
                        return null;
                    }
                }
            }

            rd.Close();
            return objList;
        }
开发者ID:rodricios,项目名称:OaiHarvestAndStore,代码行数:83,代码来源:oai.cs

示例4: CheckForUpdates

        /// <summary>
        /// Checks for new updates for the application
        /// </summary>
        public UpdateInfo CheckForUpdates(Uri relativeURL)
        {
            UpdateInfo info = new UpdateInfo();
            info.Update = false;
            string[] CurrentVersion = new string[4];
            // To see if the user is connected to the internet...
            if (!CheckInternetConnection())
            {
                // return they have no internet connection
                return info;
            }
            try
            {
                System.Net.HttpWebRequest wr = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(relativeURL.ToString());
                wr.UserAgent = "PARTY BUFFALO\r\n";
                System.Net.WebResponse response = wr.GetResponse();
                Stream responseStream = response.GetResponseStream();
                System.Xml.XmlTextReader r = new System.Xml.XmlTextReader(responseStream);
                while (r.Read())
                {
                    if (r.NodeType == System.Xml.XmlNodeType.Element)
                    {
                        // If we're getting the current version that's available
                        if (r.Name == "CurrentVersion")
                        {
                            // Set the update version to the inner text
                            info.UpdateVersion = r.ReadInnerXml();
                            // Split it at every instance of a period so that
                            // we can compare each number individually
                            CurrentVersion = info.UpdateVersion.Split('.');
                            // Get our current version, split that as well
                            string[] AppVersion = System.Windows.Forms.Application.ProductVersion.Split('.');
                            // Create new int arrays that contain the current &
                            // updated versions
                            int[] Current = new int[4];
                            int[] App = new int[4];
                            // Set their indexes accordingly
                            for (int i = 0; i < Current.Length; i++)
                            {
                                Current[i] = Convert.ToInt32(CurrentVersion[i]);
                                App[i] = Convert.ToInt32(AppVersion[i]);
                            }

                            // If the major is larger than current, there's an update
                            if (Current[0] > App[0])
                            {
                                info.Update = true;
                                return info;
                            }
                            else if (Current[0] < App[0])
                            {
                                return info;
                            }
                            // If the minor is larger than the current, there's an update :O
                            if (Current[1] > App[1])
                            {
                                info.Update = true;
                                return info;
                            }
                            else if (Current[1] < App[1])
                            {
                                return info;
                            }
                            // Same for build
                            if (Current[2] > App[2])
                            {
                                info.Update = true;
                                return info;
                            }
                            else if (Current[2] < App[2])
                            {
                                return info;
                            }
                            // Same for revision
                            if (Current[3] > App[3])
                            {
                                info.Update = true;
                                return info;
                            }
                            else if (Current[3] < App[3])
                            {
                                return info;
                            }
                            // None of those guys returned anything -- they must have
                            // the current version, return our info
                            return info;
                        }

                        if (r.Name == "UpdateFixes")
                        {
                            info.UpdateText = r.ReadInnerXml();
                        }

                        if (r.Name == "UpdatePath")
                        {
                            info.UpdatePath = r.ReadInnerXml();
                        }
//.........这里部分代码省略.........
开发者ID:709881059,项目名称:party-buffalo,代码行数:101,代码来源:Update.cs

示例5: Process_SRU

        private System.Collections.ArrayList Process_SRU(string xml)
        {
            System.Xml.XmlTextReader rd;
            System.Collections.ArrayList tp = new System.Collections.ArrayList();

            System.Xml.XmlDocument objDoc = new System.Xml.XmlDocument();
            objDoc.XmlResolver = null;
            System.Xml.XmlNamespaceManager Manager = new System.Xml.XmlNamespaceManager(objDoc.NameTable);
            System.Xml.XmlNodeList objNodes;
            string RetrievedRecords = "0";
            System.Collections.ArrayList RecordSet = new System.Collections.ArrayList();

            rd = new System.Xml.XmlTextReader(xml, System.Xml.XmlNodeType.Document, null);
            string RecordPosition = "1";

            while (rd.Read())
            {
                if (rd.NodeType == System.Xml.XmlNodeType.Element)
                {
                    if (rd.Name.IndexOf("numberOfRecords") > -1)
                    {
                        RetrievedRecords = rd.ReadString();
                    }
                    if (rd.Name.IndexOf("recordData") > -1)
                    {
                        RecordSet.Add(rd.ReadInnerXml());
                        //this needs to go somewhere
                    }
                    if (rd.Name.IndexOf("recordPosition") > -1)
                    {
                        RecordPosition = rd.ReadString();
                    }
                }
            }

            rd.Close();

            for (int x = 0; x < RecordSet.Count; x++)
            {
                struct_Records st_recs = new struct_Records();
                st_recs.xml = (string)RecordSet[x];

                Manager.AddNamespace("marc", "http://www.loc.gov/MARC21/slim");
                //try
                //{
                objDoc.LoadXml((string)RecordSet[x]);
                objNodes = objDoc.SelectNodes("marc:record/marc:datafield[@tag='150']", Manager);
                if (objNodes == null)
                {
                    objNodes = objDoc.SelectNodes("record/datafield[@tag='150']", Manager);
                }
                foreach (System.Xml.XmlNode objNode in objNodes)
                {
                    st_recs.xml = objNode.InnerXml;

                    System.Xml.XmlNodeList codes = objNode.SelectNodes("marc:subfield", Manager);
                    if (codes == null)
                    {
                        codes = objNode.SelectNodes("subfield", Manager);
                    }

                    foreach (System.Xml.XmlNode objN in codes)
                    {
                        st_recs.display += objN.InnerText + " -- ";
                        st_recs.main += "$" + objN.Attributes["code"].InnerText + objN.InnerText;
                    }

                    if (st_recs.display != null)
                    {
                        st_recs.display = st_recs.display.TrimEnd(" -".ToCharArray());
                    }
                    else
                    {
                        st_recs.display = "";
                    }

                }

                if (objNodes.Count <= 0)
                {

                    st_recs.main = "Undefined";
                    st_recs.xml = "<undefined>undefined</undefined>";
                }
                //}
                //catch
                //{
                //    return null;
                //}
                tp.Add(st_recs);
            }

            RecordCount = System.Convert.ToInt32(RetrievedRecords);
            return tp;
        }
开发者ID:reeset,项目名称:oclc_api,代码行数:95,代码来源:oclc_api_search.cs

示例6: ProcessRequest

		public void ProcessRequest( HttpContext context )
		{
			 if (!SiteSecurity.IsValidContributor()) 
			{
				context.Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html");
			}

			SiteConfig siteConfig = SiteConfig.GetSiteConfig();

			string entryId = "";
			string author = "";
			string title = "";
			string textToSave = "";
			string redirectUrl = SiteUtilities.GetStartPageUrl();


			System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(context.Request.InputStream);
			try
			{
				while (!xtr.EOF)
				{
					xtr.Read();
					if (xtr.Name=="entryid")
					{
						entryId = xtr.ReadInnerXml();
					}
					if (xtr.Name=="author")
					{
						author = xtr.ReadInnerXml();
					}
					if (xtr.Name=="title" && xtr.NodeType == System.Xml.XmlNodeType.Element)
					{
						// Ensure this is the start element before moving forward to the CDATA.
						xtr.Read();  // Brings us to the CDATA inside "title"
						title = xtr.Value;
					}
					if (xtr.Name=="posttext" && xtr.NodeType == System.Xml.XmlNodeType.Element)
					{
						xtr.Read();
						textToSave = xtr.Value;
					}
				}
			}
			finally
			{
				xtr.Close();
			}


			// make sure the entry param is there
			if (entryId == null || entryId.Length == 0) 
			{
				context.Response.Redirect(SiteUtilities.GetStartPageUrl(siteConfig));
				return;
			}
			else
			{
				ILoggingDataService logService = LoggingDataServiceFactory.GetService(SiteConfig.GetLogPathFromCurrentContext());
				IBlogDataService dataService = BlogDataServiceFactory.GetService(SiteConfig.GetContentPathFromCurrentContext(), logService );
			
				// First, attempt to get the entry.  If the entry exists, then get it for editing 
				// and save.  If not, create a brand new entry and save it instead.
				Entry entry = dataService.GetEntry(entryId);
				if ( entry != null )
				{
					entry = dataService.GetEntryForEdit( entryId );
					Entry modifiedEntry = entry.Clone();
					modifiedEntry.Content = textToSave;
					modifiedEntry.Title = title;
					modifiedEntry.Author = author;
					modifiedEntry.Syndicated = false;
					modifiedEntry.IsPublic = false;
					modifiedEntry.ModifiedUtc = DateTime.Now.ToUniversalTime();
					modifiedEntry.Categories = "";
					dataService.SaveEntry(modifiedEntry, null);

					//context.Request.Form["textbox1"];
					
					logService.AddEvent(
						new EventDataItem( 
						EventCodes.EntryChanged, entryId, 
						context.Request.RawUrl));
				}
				else
				{
					// This is a brand new entry.  Create the entry and save it.
					entry = new Entry();
					entry.EntryId = entryId;
					entry.CreatedUtc = DateTime.Now.ToUniversalTime();
					entry.ModifiedUtc = DateTime.Now.ToUniversalTime();
					entry.Title = title;
					entry.Author = author;
					entry.Content = textToSave;
					entry.Syndicated = false;
					entry.IsPublic = false;
					dataService.SaveEntry(entry, null);

					//context.Request.Form["textbox1"];
					
					logService.AddEvent(
//.........这里部分代码省略.........
开发者ID:plntxt,项目名称:dasblog,代码行数:101,代码来源:AutoSaveEntryHandler.cs


注:本文中的System.Xml.XmlTextReader.ReadInnerXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。