本文整理汇总了C#中XmlReader.ReadEndElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadEndElement方法的具体用法?C# XmlReader.ReadEndElement怎么用?C# XmlReader.ReadEndElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadEndElement方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadXml
public void ReadXml(XmlReader reader)
{
reader.ReadStartElement(); //wrapping element
this.name = reader.ReadElementContentAsString();
this.extension = reader.ReadElementContentAsString();
string tempFileName = Path.GetTempFileName();
this.streamFileName = tempFileName;
using (FileStream fs = File.Create(tempFileName))
{
byte[] buffer = new byte[1000];
int bytesRead;
reader.ReadStartElement();
do
{
bytesRead = reader.ReadContentAsBase64(buffer, 0, buffer.Length);
fs.Write(buffer, 0, bytesRead);
} while (bytesRead > 0);
reader.ReadEndElement();
}
reader.ReadEndElement(); //wrapping element
}
示例2:
void IXmlSerializable.ReadXml(XmlReader r)
{
r.MoveToContent();
r.ReadStartElement("Employee");
r.ReadStartElement("Name");
FirstName = r.ReadElementString("First", ns);
LastName = r.ReadElementString("Last", ns);
r.ReadEndElement();
r.MoveToContent();
ID = Int32.Parse(r.ReadElementString("ID", ns));
r.ReadEndElement();
}
示例3: ReadObject
public override object ReadObject(XmlReader reader)
{
ArrayOfLoanStateCompositeType ArrayOfLoanStateCompositeTypeField = null;
if (IsParentStartElement(reader, false, true))
{
ArrayOfLoanStateCompositeTypeField = new ArrayOfLoanStateCompositeType();
reader.Read();
LoanStateCompositeTypeDataContractSerializer LoanStateCompositeTypeDCS = new LoanStateCompositeTypeDataContractSerializer("LoanStateCompositeType", "http://schemas.datacontract.org/2004/07/", "http://schemas.datacontract.org/2004/07/");
System.Collections.ArrayList LoanStateCompositeType_List = new System.Collections.ArrayList();
for (int i = 0; (i > -1); i = (i + 1))
{
if (!IsChildStartElement(reader, "LoanStateCompositeType", false, false))
{
ArrayOfLoanStateCompositeTypeField.LoanStateCompositeType = new LoanStateCompositeType[LoanStateCompositeType_List.Count];
LoanStateCompositeType_List.CopyTo(ArrayOfLoanStateCompositeTypeField.LoanStateCompositeType);
break;
}
LoanStateCompositeType_List.Add(((LoanStateCompositeType)(LoanStateCompositeTypeDCS.ReadObject(reader))));
}
reader.ReadEndElement();
}
return ArrayOfLoanStateCompositeTypeField;
}
示例4: ReadString
public string ReadString(XmlReader reader)
{
reader.Read();
string s = reader.ReadString();
reader.ReadEndElement();
return s;
}
示例5: ReadObject
public static void ReadObject(XmlReader reader, object obj, PropertyConversionHandler handler = null)
{
if (obj == null)
throw new ArgumentNullException("obj");
reader.MoveToContent();
if (obj is IXmlSerializable)
{
((IXmlSerializable)obj).ReadXml(reader);
}
else
{
object oVal = null;
string oName = GetAttributeValue(obj.GetType(), typeof(XmlRootAttribute), "ElementName", true, ref oVal) ? oVal.ToString() : obj.GetType().Name;
if (reader.LocalName != oName)
throw new XmlException("XML element name does not match object.");
if (!reader.IsEmptyElement)
{
reader.ReadStartElement();
reader.MoveToContent();
ReadObjectProperties(reader, obj, handler);
reader.ReadEndElement();
}
else
reader.Skip();
}
}
示例6: LoadStatus
/// <summary>
/// Loads the status.
/// </summary>
/// <param name="reader">Reader.</param>
protected override void LoadStatus (XmlReader reader)
{
base.LoadStatus (reader);
reader.ReadToNextSibling ("Mana");
mana.value = reader.ReadElementContentAsFloat ();
Debug.Log("Found Exp field: " + reader.ReadToNextSibling ("Exp"));
Debug.Log("Found level field: " + reader.ReadToNextSibling ("Level"));
GetComponent<Inventory> ().LoadInventory (reader);
reader.ReadEndElement ();
}
示例7: Load
/// <summary>
/// Load an instance using the specified reader.
/// </summary>
/// <param name="reader">Reader.</param>
public override void Load (XmlReader reader)
{
reader.ReadToFollowing ("Wizard");
base.Load (reader);
reader.ReadEndElement ();
}
示例8: LoadPosition
protected void LoadPosition(XmlReader reader) {
reader.ReadToFollowing ("Position");
reader.ReadToDescendant ("x");
Vector3 loadedPosition = new Vector3 ();
loadedPosition.x = reader.ReadElementContentAsFloat ();
reader.ReadToNextSibling ("y");
loadedPosition.y = reader.ReadElementContentAsFloat ();
reader.ReadToNextSibling ("z");
loadedPosition.z = reader.ReadElementContentAsFloat ();
transform.position = loadedPosition;
reader.ReadEndElement ();
}