本文整理汇总了C#中System.Xml.XmlReader.ReadStartElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadStartElement方法的具体用法?C# XmlReader.ReadStartElement怎么用?C# XmlReader.ReadStartElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadStartElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadXml
protected virtual void ReadXml(XmlReader reader, SyndicationFeed result)
{
if (result == null)
throw new ArgumentNullException("result");
else if (reader == null)
throw new ArgumentNullException("reader");
reader.ReadStartElement(); // Read in <RDF>
reader.ReadStartElement("channel"); // Read in <channel>
while (reader.IsStartElement()) // Process <channel> children
{
if (reader.IsStartElement("title"))
result.Title = new TextSyndicationContent(reader.ReadElementString());
else if (reader.IsStartElement("link"))
result.Links.Add(new SyndicationLink(new Uri(reader.ReadElementString())));
else if (reader.IsStartElement("description"))
result.Description = new TextSyndicationContent(reader.ReadElementString());
else
reader.Skip();
}
reader.ReadEndElement(); // Read in </channel>
while (reader.IsStartElement())
{
if (reader.IsStartElement("item"))
{
result.Items = this.ReadItems(reader, result);
break;
}
else
reader.Skip();
}
}
示例2: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
Value = reader["Value"];
if (reader.IsEmptyElement) {
reader.ReadStartElement();
return;
}
reader.ReadStartElement();
while (!reader.EOF) {
if (reader.IsStartElement()) {
switch (reader.Name) {
case "Animation":
XmlAnimationElement animation = new XmlAnimationElement();
animation.ReadXml(reader);
Animation = animation;
break;
default:
reader.Skip();
break;
}
}
else if (reader.NodeType == XmlNodeType.EndElement) {
reader.ReadEndElement();
break;
}
else
reader.Read();
}
}
示例3: ReadXml
public void ReadXml(XmlReader reader)
{
// Start to use the reader.
reader.Read();
// Read the first element ie root of this object
reader.ReadStartElement("dictionary");
// Read all elements
while (reader.NodeType != XmlNodeType.EndElement)
{
// parsing the item
reader.ReadStartElement("item");
// PArsing the key and value
string key = reader.ReadElementString("key");
string value = reader.ReadElementString("value");
// en reading the item.
reader.ReadEndElement();
reader.MoveToContent();
// add the item
Add(key, value);
}
// Extremely important to read the node to its end.
// next call of the reader methods will crash if not called.
reader.ReadEndElement();
}
示例4: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
DefaultAnimation = reader["DefaultAnimation"];
if (reader.IsEmptyElement) {
reader.ReadStartElement();
return;
}
reader.ReadStartElement();
while (!reader.EOF) {
if (reader.IsStartElement()) {
switch (reader.Name) {
case "Activity":
XmlActivityElement activity = new XmlActivityElement();
activity.ReadXml(reader);
Activities.Add(activity);
break;
default:
reader.Skip();
break;
}
}
else if (reader.NodeType == XmlNodeType.EndElement) {
reader.ReadEndElement();
break;
}
else
reader.Read();
}
}
示例5: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
if (reader.IsEmptyElement) {
reader.ReadStartElement();
return;
}
reader.ReadStartElement();
while (!reader.EOF) {
if (reader.IsStartElement()) {
switch (reader.Name) {
case "Transform":
XmlTransformElement transform = new XmlTransformElement();
transform.ReadXml(reader);
Transform = transform;
break;
default:
reader.Skip();
break;
}
}
else if (reader.NodeType == XmlNodeType.EndElement) {
reader.ReadEndElement();
break;
}
else
reader.Read();
}
}
示例6: ClientData
private ClientData(XmlReader reader)
{
reader.ReadStartElement("ClientData");
for (int iter = 0; iter < _NumStoredValues; iter++) {
reader.ReadStartElement(_StoredValueNames[iter]);
if (_StoredValues[iter] is string)
_StoredValues[iter] = reader.ReadContentAsString();
else if (_StoredValues[iter] is DateTime) {
string s = reader.ReadContentAsString();
long l = long.Parse(s, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
_StoredValues[iter] = DateTime.FromFileTimeUtc(l);
} else if (_StoredValues[iter] is bool) {
string s = reader.ReadContentAsString();
_StoredValues[iter] = !(string.IsNullOrEmpty(s) || s != "1");
} else {
_StoredValues[iter] = ReadStringArray(reader);
}
reader.ReadEndElement();
}
reader.ReadEndElement();
}
示例7: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
Source = reader["Source"];
if (reader.IsEmptyElement) {
reader.ReadStartElement();
return;
}
reader.ReadStartElement();
while (!reader.EOF) {
if (reader.IsStartElement()) {
switch (reader.Name) {
case "Sprite":
XmlSpriteElement sprite = new XmlSpriteElement();
sprite.ReadXml(reader);
Sprites.Add(sprite);
break;
default:
reader.Skip();
break;
}
}
else if (reader.NodeType == XmlNodeType.EndElement) {
reader.ReadEndElement();
break;
}
else
reader.Read();
}
}
示例8: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
Name = reader["Name"];
if (reader.IsEmptyElement) {
reader.ReadStartElement();
return;
}
reader.ReadStartElement();
while (!reader.EOF) {
if (reader.IsStartElement()) {
switch (reader.Name) {
case "Directions":
ReadDirectionsXml(reader);
break;
default:
reader.Skip();
break;
}
}
else if (reader.NodeType == XmlNodeType.EndElement) {
reader.ReadEndElement();
break;
}
else
reader.Read();
}
}
示例9: ReadXml
public void ReadXml(XmlReader reader)
{
if (reader.IsEmptyElement) return;
reader.ReadStartElement("CommandCollection");
reader.ReadStartElement("Commands");
while(reader.NodeType != XmlNodeType.EndElement)
{
var c = new Command();
switch(reader.Name)
{
case "AttackCommand":
_mutableSerializer = new XmlSerializer(typeof(AttackCommand));
c = (AttackCommand)_mutableSerializer.Deserialize(reader);
Commands.Add(c);
break;
case "TimedCommand":
_mutableSerializer = new XmlSerializer(typeof(TimedCommand));
c = (TimedCommand)_mutableSerializer.Deserialize(reader);
Commands.Add(c);
break;
}
}
reader.ReadEndElement();
reader.ReadEndElement();
}
示例10: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
Repeat = Convert.ToInt32(reader["Repeat"], CultureInfo.InvariantCulture);
if (reader.IsEmptyElement) {
reader.ReadStartElement();
return;
}
reader.ReadStartElement();
while (!reader.EOF) {
if (reader.IsStartElement()) {
switch (reader.Name) {
case "Frames":
ReadFramesXml(reader);
break;
default:
reader.Skip();
break;
}
}
else if (reader.NodeType == XmlNodeType.EndElement) {
reader.ReadEndElement();
break;
}
else
reader.Read();
}
}
示例11: Read
/// <summary>
///
/// </summary>
/// <param name="reader"></param>
/// <param name="transactions"></param>
internal static void Read(XmlReader reader, IList<TransactionSummary> transactions, bool preApproval)
{
transactions.Clear();
if (reader.IsEmptyElement)
{
XMLParserUtils.SkipNode(reader);
}
if (preApproval == true)
reader.ReadStartElement(TransactionSummaryListSerializer.PreApprovals);
else
reader.ReadStartElement(TransactionSummaryListSerializer.Transactions);
reader.MoveToContent();
while (!reader.EOF)
{
if (preApproval == true)
{
if (XMLParserUtils.IsEndElement(reader, TransactionSummaryListSerializer.PreApprovals))
{
XMLParserUtils.SkipNode(reader);
break;
}
}
else
{
if (XMLParserUtils.IsEndElement(reader, TransactionSummaryListSerializer.Transactions))
{
XMLParserUtils.SkipNode(reader);
break;
}
}
if (reader.NodeType == XmlNodeType.Element)
{
TransactionSummary transaction = new TransactionSummary();
switch (reader.Name)
{
case TransactionSerializerHelper.Transaction:
TransactionSummarySerializer.Read(reader, transaction, preApproval);
transactions.Add(transaction);
break;
case TransactionSerializerHelper.PreApproval:
TransactionSummarySerializer.Read(reader, transaction, preApproval);
transactions.Add(transaction);
break;
default:
XMLParserUtils.SkipElement(reader);
break;
}
}
else
{
XMLParserUtils.SkipNode(reader);
}
}
}
示例12: FromXml
public bool FromXml(XmlReader reader)
{
if (reader.Name != "Node")
{
return false;
}
reader.ReadStartElement();
Rounds = new List<Round>();
if (reader.Name == "Rounds")
{
reader.ReadStartElement();
Round round;
while (reader.Name == "Round")
{
round = new Round();
if (!round.FromXml(reader))
{
return false;
}
Rounds.Add(round);
}
if (reader.Name == "Rounds" && reader.NodeType == XmlNodeType.EndElement)
{
reader.ReadEndElement();
}
}
Items = new List<Item>();
if (reader.Name == "Items")
{
reader.ReadStartElement();
Item item;
while (reader.Name == "Item")
{
item = new Item();
if (!item.FromXml(reader))
{
return false;
}
Items.Add(item);
}
if (reader.Name == "Items" && reader.NodeType == XmlNodeType.EndElement)
{
reader.ReadEndElement();
}
}
if (reader.Name == "Node" && reader.NodeType == XmlNodeType.EndElement)
{
reader.ReadEndElement();
}
return true;
}
示例13: ReadXml
public void ReadXml(XmlReader reader)
{
reader.ReadStartElement(typeof(infNFeSupl).Name);
reader.ReadStartElement("qrCode");
qrCode = reader.ReadString();
reader.ReadEndElement();
reader.ReadEndElement();
}
示例14: ReadXml
public override void ReadXml(XmlReader reader)
{
reader.ReadStartElement();
reader.ReadStartElement("X");
var x = reader.ReadContentAsDouble();
reader.ReadEndElement();
reader.ReadStartElement("Y");
var y = reader.ReadContentAsDouble();
reader.ReadEndElement();
Value = new Point(x, y);
reader.ReadEndElement();
}
示例15: ReadXml
public override void ReadXml(XmlReader reader)
{
var isEmptyElement = reader.IsEmptyElement;
reader.ReadStartElement();
if (!isEmptyElement)
{
reader.ReadStartElement("Format");
Format = reader.ReadContentAsString();
reader.ReadEndElement();
OnlineResource.ReadXml(reader);
}
}