本文整理汇总了C#中XmlReader.ReadNextStartElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadNextStartElement方法的具体用法?C# XmlReader.ReadNextStartElement怎么用?C# XmlReader.ReadNextStartElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadNextStartElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Create a data reader based on an xml data reader. This mathod looks into the first element
/// and creates the right reader (Generic, Compact, Utility, CrossSectional).
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="keyFamily">The key family.</param>
/// <returns>An instance of the DataReader.</returns>
public static DataReader Create(XmlReader reader, KeyFamily keyFamily)
{
Contract.AssertNotNull(reader, "reader");
if (reader.ReadState == ReadState.Initial)
{
reader.Read();
}
if (reader.NodeType != XmlNodeType.Element)
{
reader.ReadNextStartElement();
}
if (reader.LocalName == "CompactData")
return new CompactDataReader(reader, keyFamily);
else if (reader.LocalName == "GenericData")
return new GenericDataReader(reader, keyFamily);
else
throw new SDMXException("Unsupported root element ({0}) for data file.", reader.LocalName);
}