本文整理汇总了C#中System.Xml.XmlReader.ReadEndElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadEndElement方法的具体用法?C# XmlReader.ReadEndElement怎么用?C# XmlReader.ReadEndElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadEndElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: ReadXml
public override void ReadXml(XmlReader reader)
{
reader.MoveToContent();
if (reader.AttributeCount == 0)
throw new MissingXmlAttributeException(@"Missing XML attribute ""value"".");
Name = reader["name"];
if (reader.IsEmptyElement)
{
reader.ReadEndElement();
return;
}
if (reader.ReadToDescendant(ChildXmlTag))
{
while (reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == ChildXmlTag)
{
reader.ReadStartElement();
reader.MoveToContent();
IilParameter p = IilParameter.fromString(reader.LocalName);
p.ReadXml(reader);
Parameters.Add(p);
reader.ReadEndElement();
}
}
reader.ReadEndElement();
//reader.Read();
}
示例3: Read
public bool Read(XmlReader reader)
{
if(reader.IsStartElement() && reader.Name == "Fixture") {
Fixture fixture = new Fixture();
//...Any attributes go here...
fixture.AllowFrameSkip = bool.Parse(reader.GetAttribute("allowFrameSkip"));
fixture.Name = reader.GetAttribute("name");
// This needs to hold off until after channels are loaded.
string fixtureDefinitionName = reader.GetAttribute("fixtureDefinitionName");
if(reader.ElementsExistWithin("Fixture")) { // Entity element
// Channels
if(reader.ElementsExistWithin("Channels")) { // Container element for child entity
ChannelReader<OutputChannel> channelReader = new ChannelReader<OutputChannel>();
while(channelReader.Read(reader)) {
fixture.InsertChannel(channelReader.Channel);
}
reader.ReadEndElement(); // Channels
}
// With channels loaded, the fixture template reference can be set.
fixture.FixtureDefinitionName = fixtureDefinitionName;
reader.ReadEndElement(); // Fixture
this.Fixture = fixture;
}
return true;
}
return false;
}
示例4: 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();
}
示例5: 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;
}
示例6: 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();
}
示例7: 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;
}
示例8: ReadXml
public void ReadXml(XmlReader reader)
{
reader.ReadStartElement(typeof(infNFeSupl).Name);
reader.ReadStartElement("qrCode");
qrCode = reader.ReadString();
reader.ReadEndElement();
reader.ReadEndElement();
}
示例9: 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();
}
示例10: Read
/// <summary>
/// Reads the next blueprint from the specified reader.
/// </summary>
/// <param name="reader">Reader to read the next blueprint from.</param>
/// <returns>Read blueprint.</returns>
public Blueprint Read(XmlReader reader)
{
reader.Read();
reader.Read();
var blueprintId = reader[BlueprintIdAttributeName];
var blueprint = new Blueprint(blueprintId);
// Read blueprint id.
reader.ReadStartElement(BlueprintElementName);
{
// Read property values.
reader.ReadStartElement(PropertyValuesElementName);
{
while (reader.IsStartElement(PropertyElementName))
{
var key = reader[PropertyKeyAttributeName];
var typeName = reader[PropertyTypeAttributeName];
var type = Type.GetType(typeName);
reader.ReadStartElement(PropertyElementName);
{
var value =
new XmlSerializer(type, new XmlRootAttribute(PropertyValueElementName)).Deserialize(
reader);
// Add to blueprint.
blueprint.PropertyValues.Add(key, value);
}
reader.ReadEndElement();
}
}
reader.ReadEndElement();
// Read components.
reader.ReadStartElement(ComponentsElementName);
{
while (reader.IsStartElement(ComponentElementName))
{
var component = reader.ReadElementContentAsString();
// Add to blueprint.
blueprint.ComponentTypes.Add(component);
}
}
reader.ReadEndElement();
}
reader.ReadEndElement();
return blueprint;
}
示例11: while
/// <summary>
/// Generates an object from its XML representation.
/// </summary>
/// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param>
void IXmlSerializable.ReadXml(XmlReader reader)
{
reader.Read();
reader.ReadStartElement("dictionary");
while (reader.NodeType != XmlNodeType.EndElement) {
reader.ReadStartElement("item");
string key = reader.ReadElementString("key");
string value = reader.ReadElementString("value");
reader.ReadEndElement();
reader.MoveToContent();
this.Add(key, value);
}
reader.ReadEndElement();
}
示例12: ReadXml
public override void ReadXml(XmlReader reader)
{
reader.MoveToContent();
var isEmpty = reader.IsEmptyElement;
reader.ReadStartElement();
if (!isEmpty)
{
reader.ReadStartElement("Title");
Title = reader.ReadContentAsString();
reader.ReadEndElement();
OnlineResource.ReadXml(reader);
LogoURL.ReadXml(reader);
reader.ReadEndElement();
}
}
示例13: Deserialize
/// <summary>
/// Deserializes an ChangedItem from an XML file.
/// </summary>
/// <param name="reader">XMLReader where the ChangedItem is.</param>
/// <returns>ChangedItem.</returns>
public static ChangedItem Deserialize(XmlReader reader)
{
ChangedItem lResult = null;
if (reader.IsStartElement(DTD.Error.ChangedItems.TagChangedItem))
{
lResult = new ChangedItem();
string stringModelType = reader.GetAttribute(DTD.Error.ChangedItems.ChangedItem.TagType);
ModelType modelType = Convert.StringTypeToMODELType(stringModelType);
if (modelType == ModelType.Oid)
{
lResult.Type = Convert.MODELTypeToStringType(ModelType.Oid);
lResult.ClassName = stringModelType;
}
else
{
lResult.Type = stringModelType;
lResult.ClassName = string.Empty;
}
lResult.Name = reader.GetAttribute(DTD.Error.ChangedItems.ChangedItem.TagName);
if (!reader.IsEmptyElement)
{
reader.ReadStartElement();
if (reader.IsStartElement(DTD.Error.ChangedItems.ChangedItem.TagChangedItemOldValue))
{
lResult.OldValue = XMLChangedItemValueSerializer.Deserialize(reader.ReadSubtree(),lResult.Type, lResult.ClassName);
reader.ReadEndElement();
}
if (reader.IsStartElement(DTD.Error.ChangedItems.ChangedItem.TagChangedItemNewValue))
{
lResult.NewValue = XMLChangedItemValueSerializer.Deserialize(reader.ReadSubtree(), lResult.Type, lResult.ClassName);
reader.ReadEndElement();
}
}
else
{
reader.Skip();
}
}
else
{
throw new ArgumentException("Xml Reader don't have the ChangedItem in Start Element.", "XmlReader reader");
}
return lResult;
}
示例14: ReadXml
public void ReadXml(XmlReader reader)
{
bool isEmpty = reader.IsEmptyElement;
AddAttributeExtensions(reader);
reader.ReadStartElement();
if (!isEmpty)
{
while (reader.IsStartElement())
{
if (reader.LocalName == Backlink.ELEMENT_NAME)
{
if (BacklinkItems == null)
{
BacklinkItems = new List<Backlink>();
}
var backlink = new Backlink();
backlink.ReadXml(reader);
BacklinkItems.Add(backlink);
}
else
{
ElementExtensions.Add((XElement)XNode.ReadFrom(reader));
}
}
}
reader.ReadEndElement();
}
示例15: ReadXml
public override void ReadXml(XmlReader reader)
{
reader.ReadStartElement("RemovePortCommand", Context.YttriumNamespace);
base.ReadXml(reader);
_isolate = bool.Parse(reader.ReadElementString("Isolate"));
reader.ReadEndElement();
}