本文整理汇总了C#中System.Xml.XmlReader.ReadString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadString方法的具体用法?C# XmlReader.ReadString怎么用?C# XmlReader.ReadString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessXmlCore
internal override void ProcessXmlCore (XmlReader reader)
{
switch (reader.Name) {
case "name":
name = reader.ReadString ();
break;
case "sort-name":
sort_name = reader.ReadString ();
break;
case "disambiguation":
disambiguation = reader.ReadString ();
break;
case "life-span":
begin_date = reader ["begin"];
end_date = reader ["end"];
break;
case "alias-list":
if (reader.ReadToDescendant ("alias")) {
List<string> aliases = new List<string> ();
do aliases.Add (reader.ReadString ());
while (reader.ReadToNextSibling ("alias"));
this.aliases = aliases.AsReadOnly ();
}
break;
default:
base.ProcessXmlCore (reader);
break;
}
}
示例2: ReadXml
public void ReadXml(XmlReader reader)
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
if(reader.LocalName.Equals("Name"))
{
Name = reader.ReadString();
}
else if(reader.LocalName.Equals("PlayerGender"))
{
Gender = (Gender) Enum.Parse(typeof(Gender), reader.ReadString(), false);
}
else if(reader.LocalName.Equals("ShortDesc"))
{
ShortDesc = reader.ReadString();
}
else if(reader.LocalName.Equals("Level"))
{
Level = Convert.ToInt32(reader.ReadString());
}
}
}
}
示例3: Site
internal Site(XmlReader r)
{
while (r.Read())
{
if (r.NodeType == XmlNodeType.Element)
{
if (r.Name == "guid")
{
string content = r.ReadString();
siteId = new Guid(content);
}
else if (r.Name == "name")
{
string content = r.ReadString();
siteNickname = content;
}
else if (r.Name == "url")
{
string content = r.ReadString();
targetUri = new Uri(content);
}
else if (r.Name == "plugin")
{
string content = r.ReadString();
fetcherpluginName = content;
}
else if (r.Name == "layout")
{
string content = r.ReadString();
layoutpluginName = content;
}
}
}
}
示例4: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
reader.ReadToDescendant("Value1");
Value1 = reader.ReadString();
reader.ReadEndElement();
reader.ReadStartElement("Value2");
Value2 = int.Parse(reader.ReadString());
ReadXmlCalled = true;
}
示例5: DeserializePropertyElement
protected override void DeserializePropertyElement(XmlReader reader)
{
if (reader == null) throw new ArgumentNullException ("reader");
if (reader.NamespaceURI == Schemas.DublinCoreSchema && reader.Name == "description") {
Description = reader.ReadString ();
} if (reader.NamespaceURI == Schemas.UpnpSchema && reader.Name == "longDescription") {
LongDescription = reader.ReadString ();
} else {
base.DeserializePropertyElement (reader);
}
}
示例6: Load
internal static void Load(XmlReader x)
{
while (x.Read ()) {
switch (x.LocalName) {
case "UnittestCommand":
UnittestCommand = x.ReadString ();
break;
case "MainMethodFlag":
MainMethodFlag = x.ReadString ();
break;
}
}
}
示例7: ReadFrom
public ICustomXmlSerializer ReadFrom (XmlReader r)
{
while (r.Read ()) {
switch (r.LocalName) {
case "cmd":
DubCommand = r.ReadString ();
break;
case "commonargs":
CommonArgs = r.ReadString ();
break;
}
}
return this;
}
示例8: Deserialize
internal static XmlOnlineRecord Deserialize( XmlReader xmlReader, Version version )
{
if( xmlReader.NodeType != XmlNodeType.Element
|| xmlReader.Name != ElementName )
throw new ApplicationException( "Needs an OnlineTransaction node to deserialize an online transaction object." );
XmlOnlineRecord otrans = new XmlOnlineRecord();
if( xmlReader.GetAttribute( "id" ) != null )
otrans.Id = int.Parse( xmlReader.GetAttribute( "id" ) );
if( xmlReader.GetAttribute( "lineItemId" ) != null )
otrans.LineItemId = int.Parse( xmlReader.GetAttribute( "lineItemId" ) );
if( xmlReader.GetAttribute( "source" ) != null )
otrans.OnlineSource = xmlReader.GetAttribute( "source" );
while( xmlReader.Read() )
{
switch( xmlReader.NodeType )
{
case XmlNodeType.Element:
switch( xmlReader.Name.ToLower() )
{
case "source":
otrans.OnlineSource = xmlReader.ReadString();
break;
case "id":
otrans.Id = Int32.Parse( xmlReader.ReadString() );
break;
case "bankid":
otrans.BankId = xmlReader.ReadString();
break;
case "number":
otrans.Number = xmlReader.ReadString();
break;
case "date":
otrans.Date = DateTime.Parse( xmlReader.ReadString() );
break;
case "sequence":
otrans.Sequence = int.Parse( xmlReader.ReadString() );
break;
case "description":
otrans.Description = xmlReader.ReadString();
break;
case "amount":
otrans.Amount = Decimal.Parse( xmlReader.ReadString() );
break;
default:
break;
}
break;
case XmlNodeType.EndElement:
if( xmlReader.Name == ElementName )
return otrans;
break;
}
}
return otrans;
}
示例9: ParseElement
/// <summary>
/// Parses the WDDX element and returns the deserialized
/// content as a <see cref="System.String"/> object, advancing the reader to the next
/// element.
/// </summary>
/// <param name="input">The pre-initialized <see cref="System.Xml.XmlTextReader"/> pointing to the WDDX to be parsed.</param>
public object ParseElement(XmlReader input)
{
if (input.IsEmptyElement)
{
input.Skip();
return String.Empty;
}
StringBuilder output = new StringBuilder();
input.Read();
while (!(input.Name == "string" && input.NodeType == XmlNodeType.EndElement))
{
if (input.NodeType == XmlNodeType.Text || input.NodeType == XmlNodeType.Whitespace)
{
output.Append(input.ReadString());
}
else if (input.Name == "char")
{
// parse out the <char code="xx"/> tag
output.Append((char)Int32.Parse(input.GetAttribute("code"), NumberStyles.AllowHexSpecifier));
input.Skip();
}
}
input.ReadEndElement();
return output.ToString();
}
示例10: ReadObject
public override object ReadObject(XmlReader reader)
{
SimpleEventRequest SimpleEventRequestField = null;
if (IsParentStartElement(reader, false, true))
{
SimpleEventRequestField = new SimpleEventRequest();
SimpleEventRequestField.AnyAttr = ReadAnyAttribute(reader);
reader.Read();
if (IsChildStartElement(reader, "Param", true, true))
{
reader.Read();
string[] Param_List = reader.ReadString().Split();
if ((this._CompressByteArrays
|| ((Param_List.Length == 1)
&& (Param_List[0].Length > 2))))
{
SimpleEventRequestField.Param = Convert.FromBase64String(Param_List[0]);
}
else
{
SimpleEventRequestField.Param = new byte[Param_List.Length];
for (int i = 0; (i < Param_List.Length); i = (i + 1))
{
SimpleEventRequestField.Param[i] = XmlConvert.ToByte(Param_List[i]);
}
}
reader.ReadEndElement();
}
SimpleEventRequestField.Any = ReadAnyElement(reader, false);
reader.ReadEndElement();
}
return SimpleEventRequestField;
}
示例11: backgroundWorker1_DoWork
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
try
{
xmlReader = new XmlTextReader(textBox1.Text);
while (xmlReader.Read())
{
if (xmlReader.NodeType == XmlNodeType.Element)
{
switch (xmlReader.Name)
{
case "title":
{
Invoke((MethodInvoker)(() =>
{
checkedListBox1.Items.Add(xmlReader.ReadString());
}));
break;
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例12: ReadXml
public void ReadXml(XmlReader reader)
{
reader.ReadStartElement("PropertyName");
PropertyName = reader.ReadString();
reader.ReadEndElement();
if (!reader.IsEmptyElement)
{
reader.ReadStartElement("PropertyValue");
PropertyValue = reader.ReadString();
reader.ReadEndElement();
}
else
{
reader.Read();
}
}
示例13: DeserializePropertyElement
protected override void DeserializePropertyElement(XmlReader reader)
{
if (reader == null) throw new ArgumentNullException ("reader");
if (reader.NamespaceURI == Schemas.UpnpSchema) {
if (reader.Name == "genre") {
genre_list.Add (reader.ReadString ());
} else if (reader.Name == "artistDiscographyURI") {
ArtistDiscographyUri = new Uri (reader.ReadString ());
} else {
base.DeserializePropertyElement (reader);
}
} else {
base.DeserializePropertyElement (reader);
}
}
示例14: DeserializePropertyElement
protected override void DeserializePropertyElement(XmlReader reader)
{
if (reader == null) throw new ArgumentNullException ("reader");
if (reader.NamespaceURI == Schemas.UpnpSchema) {
switch (reader.LocalName) {
case "region":
Region = reader.ReadString ();
break;
case "radioCallSign":
RadioCallSign = reader.ReadString ();
break;
case "radioStationID":
RadioStationId = reader.ReadString ();
break;
case "radioBand":
RadioBand = reader.ReadString ();
break;
case "channelNr":
ChannelNr = reader.ReadContentAsInt ();
break;
default:
base.DeserializePropertyElement (reader);
break;
}
} else {
base.DeserializePropertyElement (reader);
}
}
示例15: ReadObject
public override object ReadObject(XmlReader reader)
{
OneWayAttachmentRequest OneWayAttachmentRequestField = null;
if (IsParentStartElement(reader, false, true))
{
OneWayAttachmentRequestField = new OneWayAttachmentRequest();
OneWayAttachmentRequestField.AnyAttr = ReadAnyAttribute(reader);
reader.Read();
if (IsChildStartElement(reader, "Param", true, true))
{
reader.Read();
if (IsAttribute(reader, "href"))
{
string contentID;
contentID = reader.Value;
reader.MoveToElement();
reader.ReadStartElement("Include", "http://www.w3.org/2004/08/xop/include");
reader.ReadEndElement();
OneWayAttachmentRequestField.Param = GetBodyPartContent(contentID, BodyParts);
}
else
{
OneWayAttachmentRequestField.Param = Convert.FromBase64String(reader.ReadString());
reader.ReadEndElement();
}
}
OneWayAttachmentRequestField.Any = ReadAnyElement(reader, false);
reader.ReadEndElement();
}
return OneWayAttachmentRequestField;
}