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


C# XmlReader.ReadOuterXml方法代码示例

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


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

示例1: DeserializeSection

		/// <summary>
		/// Reads XML from the configuration file.
		/// </summary>
		/// <param name="xmlReader">The XmlReader object, which reads from the configuration file.</param>
		protected internal override void DeserializeSection(XmlReader xmlReader)
		{
			if (RawXml == null)
				RawXml = xmlReader.ReadOuterXml();
			else
				xmlReader.Skip();
		}
开发者ID:fankluo,项目名称:APQuery.net,代码行数:11,代码来源:APGenDefaultSection.cs

示例2: Deserialize

        public static object Deserialize(Type type, XmlReader reader, bool readInnerXml)
        {
            if (null == type) throw new ArgumentNullException("type");
            if (null == reader) throw new ArgumentNullException("reader");
            if (reader.NodeType != XmlNodeType.Element) throw new ArgumentException("reader is not positioned on an element");

            object value = null;
            StringBuilder serializationBuilder = new StringBuilder();
            serializationBuilder.Append("<?xml version=\"1.0\"?>");
            if (readInnerXml)
            {
                serializationBuilder.AppendLine(reader.ReadInnerXml());
            }
            else
            {
                serializationBuilder.AppendLine(reader.ReadOuterXml());
            }
            string serialization = serializationBuilder.ToString();
            using (StringReader stringReader = new StringReader(serialization))
            {
                XmlSerializer serializer = new XmlSerializer(type);
                value = serializer.Deserialize(stringReader);
            }
            return value;
        }
开发者ID:t1b1c,项目名称:lwas,代码行数:25,代码来源:SerializationServices.cs

示例3: Searchers

        public Searchers(XmlReader reader)
        {
            this.Choices = new List<Choice>();
            this.CurrentSearch = "";

            reader.Read();
            if (reader.Name != "TheSearchers")
                return; // bail out

            reader.Read();
            while (!reader.EOF)
            {
                if ((reader.Name == "TheSearchers") && !reader.IsStartElement())
                    break; // all done

                if (reader.Name == "Current")
                    this.CurrentSearch = reader.ReadElementContentAsString();
                else if (reader.Name == "Choice")
                {
                    string url = reader.GetAttribute("URL");
                    if (url == null)
                        url = reader.GetAttribute("URL2");
                    else
                    {
                        // old-style URL, replace "!" with "{ShowName}+{Season}+{Episode}"
                        url = url.Replace("!", "{ShowName}+{Season}+{Episode}");
                    }
                    this.Add(reader.GetAttribute("Name"), url);
                    reader.ReadElementContentAsString();
                }
                else
                    reader.ReadOuterXml();
            }
        }
开发者ID:madams74,项目名称:tvrename,代码行数:34,代码来源:Searchers.cs

示例4: DeserializeSection

 protected internal override void DeserializeSection(XmlReader xmlReader) {
     if (!xmlReader.Read() || xmlReader.NodeType != XmlNodeType.Element) {
         throw new ConfigurationErrorsException(SR.GetString(SR.Config_base_expected_to_find_element), xmlReader);
     }
     _rawXml = xmlReader.ReadOuterXml();
     _isModified = true;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:IgnoreSection.cs

示例5: ReadXml

 public void ReadXml(XmlReader reader)
 {
     int sequenceCount = 0;
       bool isEmpty = reader.IsEmptyElement;
       reader.ReadStartElement();
       if (isEmpty)
     return;
       while (reader.NodeType == XmlNodeType.Element)
       {
     if (sequenceCount == 0 || reader.IsStartElement("title"))
     {
       PitchSequences.Add(new PitchSequence());
       sequenceCount++;
     }
     if (reader.IsStartElement("title"))
       PitchSequences[sequenceCount - 1].Title = reader.ReadElementString();
     else if (reader.IsStartElement("pitch"))
     {
       var pitch = new Pitch();
       pitch.ReadXml(reader);
       PitchSequences[sequenceCount - 1].Pitches.Add(pitch);
     }
     else
       reader.ReadOuterXml();
       }
       reader.ReadEndElement();
 }
开发者ID:samgoat,项目名称:NC,代码行数:27,代码来源:Pitches.cs

示例6: ReadXml

		public void ReadXml(XmlReader reader)
		{
			reader.MoveToContent();
			var empty = reader.IsEmptyElement;
			reader.ReadStartElement();
			if (!empty)
			{
				while (reader.MoveToContent() == XmlNodeType.Element)
				{
					if (reader.Name == @"ProductName" && !reader.IsEmptyElement)
					{
						ProductName = reader.ReadElementString();
					}
					else if (reader.Name == @"GlyphColor" && !reader.IsEmptyElement)
					{
						GlyphColor = ParseColor(reader.ReadElementString());
					}
					else
					{
						// consume the bad element and skip to next sibling or the parent end element tag
						reader.ReadOuterXml();
					}
				}
				reader.MoveToContent();
				reader.ReadEndElement();
			}
		}
开发者ID:nhannd,项目名称:Xian,代码行数:27,代码来源:OemConfiguration.cs

示例7: ReadXml

        public void ReadXml(XmlReader reader)
        {
            var s = reader.ReadOuterXml();
            var x = XDocument.Parse(s);
            if (x.Root == null) return;

            foreach (var e in x.Root.Elements())
            {
                var name = e.Name.ToString();
                switch (name)
                {
                    case "List":
                        foreach (var ee in e.Elements())
                            _list.Add(Util.DeSerialize<OnlineRegPersonModel>(ee.ToString()));
                        break;
                    case "History":
                        foreach (var ee in e.Elements())
                            _history.Add(ee.Value);
                        break;
                    default:
                        Util.SetPropertyFromText(this, name, e.Value);
                        break;
                }
            }
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:25,代码来源:ReadWriteXml.cs

示例8: ReadXml

 /// <summary>
 /// convert the xml representation of this class into the document and metadata properties
 /// </summary>
 /// <param name="reader"></param>
 public void ReadXml(XmlReader reader)
 {
    // good place for debug logging
     try
     {
         // take the reader, turn into an XmlDocument, then parse out the metadata and documents
         XmlDocument xmldoc = new XmlDocument();
         xmldoc.LoadXml(reader.ReadOuterXml());
         submissionMetadata = xmldoc.SelectSingleNode(@".//*[local-name()='SubmitObjectsRequest']");     // cheating and ignoring namespaces
         if (submissionMetadata == null)
         {
             // good place for debug logging
             throw new Exception("P&RRequestXDSB Reader cannot find SubmitObjectsRequest");
         }
         XmlNodeList theDocs = xmldoc.SelectNodes(@".//*[local-name()='Document']");
         if (theDocs == null)
         {
             // good place for debug logging
             throw new Exception("P&RRequestXDSB Reader cannot find Document");
         }
         foreach (XmlNode aDoc in theDocs)
         {
             SubmissionDocument theDoc = new SubmissionDocument();
             theDoc.documentID = aDoc.Attributes["id"].Value.ToString();
             theDoc.documentText = Convert.FromBase64String(aDoc.InnerText);
             submissionDocuments.Add(theDoc);
         }
     }
     catch (Exception ex)
     {
         // good place for debug logging
         throw ex;
     }
     // good place for debug logging
 }
开发者ID:DM-TOR,项目名称:nhin-d,代码行数:39,代码来源:ProvideAndregisterRequest.cs

示例9: CreateVehicleInfoChildElement

 private XElement CreateVehicleInfoChildElement(XmlReader reader)
 {
     XElement vehInfoElement = new XElement(DataLoadConstants.ELEMENT_VEHILCEINFO);
     XElement regIDElement = new XElement(XDocument.Parse(reader.ReadOuterXml()).Root);
     vehInfoElement.Add(regIDElement);
     return vehInfoElement;
 }
开发者ID:victorxata,项目名称:261120,代码行数:7,代码来源:IOLoadController.cs

示例10: ReadFrom

		private static EndpointAddress ReadFrom (System.ServiceModel.Channels.AddressingVersion addressingVersion, XmlReader xreader)
		{
			string xml = xreader.ReadOuterXml ();
			StringReader sreader = new StringReader (xml);
			XmlReader reader = XmlReader.Create (sreader);
			Uri uri = null;
			EndpointIdentity identity = null;
			reader.MoveToContent ();
			List<AddressHeader> header = new List<AddressHeader> ();
			while (reader.NodeType == XmlNodeType.Element && !reader.IsEmptyElement) {
				if (reader.LocalName == "EndpointReference") {
					reader.Read ();
				} else if (reader.LocalName == "Address" && 
					reader.NodeType == XmlNodeType.Element &&
					!reader.IsEmptyElement)
					uri = new Uri (reader.ReadElementContentAsString ());
				else if (reader.LocalName == "Identity" && 
					reader.NodeType == XmlNodeType.Element &&
					!reader.IsEmptyElement) {
					//How can key re-empact Identity
					identity = new X509CertificateEndpointIdentity (new System.Security.Cryptography.X509Certificates.X509Certificate2 ("powershell.pfx", "mono"));
					break;
				} else {
					var headerName = reader.LocalName;
					var headerNamespace = reader.NamespaceURI;
					reader.MoveToContent ();
					reader.ReadStartElement ();
					var obj = reader.ReadElementContentAs (GetTypeFromLocalName (reader.LocalName), new XmlNamespaceManager (reader.NameTable));
					header.Add (AddressHeader.CreateAddressHeader (headerName, headerNamespace, obj));
					reader.MoveToContent ();
					reader.ReadEndElement ();
				}
			}
			return identity == null ? new EndpointAddress(uri, header.ToArray ()) : new EndpointAddress(uri, identity, header.ToArray ());
	  }
开发者ID:nickchal,项目名称:pash,代码行数:35,代码来源:EnumerationItem.cs

示例11: ReadOuterXml

 private string ReadOuterXml(XmlReader forReader) {
     try {
         forReader.MoveToContent();
         return forReader.ReadOuterXml();
     } finally {
         forReader.Close();
     }
 }
开发者ID:gsbastian,项目名称:Sriracha.Deploy,代码行数:8,代码来源:XmlInputTests.cs

示例12: ReadXml

        public void ReadXml(XmlReader reader)
        {
            var s = reader.ReadOuterXml();
            var x = XDocument.Parse(s);
            if (x.Root == null) return;

            eqset = 0;
            txset = 0;
            menuset = 0;

            foreach (var e in x.Root.Elements())
            {
                var name = e.Name.ToString();
                switch (name)
                {
                    case "FundItem":
                        ReadFundItem(e);
                        break;
                    case "FamilyAttend":
                        ReadFamilyAttend(e);
                        break;
                    case "ExtraQuestion":
                        ReadExtraQuestion(e);
                        break;
                    case "Text":
                        ReadText(e);
                        break;
                    case "YesNoQuestion":
                        ReadYesNoChoices(e);
                        break;
                    case "option":
                        ReadDropdownOption(e);
                        break;
                    case "Checkbox":
                        ReadCheckboxChoice(e);
                        break;
                    case "MenuItem":
                        ReadMenuItemChoice(e);
                        break;
                    case "MissionTripGoerId":
                        MissionTripGoerId = e.Value.ToInt();
                        break;
                    case "CreatingAccount":
                        CreatingAccount = e.Value.ToBool();
                        break;
                    case "SpecialTest":
                        ReadSpecialTest(e);
                        break;
                    default:
                        if (Util.SetPropertyFromText(this, TranslateName(name), e.Value) == false)
                        {
                            ErrorSignal.FromCurrentContext().Raise(new Exception("OnlineRegPerson Missing name:" + name));
                            Log($"Error:Missing({name})");
                        }
                        break;
                }
            }
        }
开发者ID:alexserdyuk,项目名称:bvcms,代码行数:58,代码来源:ReadXml.cs

示例13: RequiredAttribute

		private static string RequiredAttribute(XmlReader reader, string attribute)
		{
			string result = OptionalAttribute(reader, attribute);
			if(result == null)
			{
				throw Error.CouldNotFindRequiredAttribute(attribute, reader.ReadOuterXml());
			}
			return result;
		}
开发者ID:modulexcite,项目名称:LinqToSQL2,代码行数:9,代码来源:XmlMappingReader.cs

示例14: DeserializeSection

        protected override void DeserializeSection(XmlReader reader)
        {
            if (!reader.Read() || (reader.NodeType != XmlNodeType.Element))
            {
                throw new ConfigurationErrorsException("Expected to find element");
            }

            _rawXml = reader.ReadOuterXml();
        }
开发者ID:BrianGoff,项目名称:BITS,代码行数:9,代码来源:XmlNodeSectionHandler.cs

示例15: ProcessDataReader

 private void ProcessDataReader(XmlReader reader)
 {
     ResultsListBox.Items.Clear();
     while (reader.Read())
     {
         ResultsListBox.Items.Add(reader.ReadOuterXml());
         //MessageBox.Show(reader.ReadOuterXml());
     }
     reader.Close();
 }
开发者ID:rjgodia30,项目名称:bcit-courses,代码行数:10,代码来源:TestXMLDataReader.cs


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