本文整理汇总了C#中System.Xml.XmlReader.ValueAsXName方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ValueAsXName方法的具体用法?C# XmlReader.ValueAsXName怎么用?C# XmlReader.ValueAsXName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ValueAsXName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadScoredProperty
public static Element ReadScoredProperty(XmlReader reader)
{
if (!reader.MoveToAttribute("name"))
throw new ReadPrintSchemaDocumentException("ScoredProperty element must contains name attribute");
var name = reader.ValueAsXName();
var element = new PrintSchemaScoredProperty(new ScoredPropertyName(name));
foreach (var child in ReadChildren(reader))
{
element.Add(child);
}
return element.GetResult();
}
示例2: ReadValue
private static Element ReadValue(XmlReader reader)
{
XName type = null;
// Read value type
if (reader.MoveToFirstAttribute())
{
do
{
var attrName = reader.XName();
if (attrName == Xsi.Type)
{
type = reader.ValueAsXName();
}
} while (reader.MoveToNextAttribute());
reader.MoveToElement();
}
if (reader.IsEmptyElement)
{
return Value.Empty;
}
var value = Value.Empty;
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Text)
{
if (type == Xsd.Integer)
{
value = reader.Value.AsInt32();
}
else if (type == Xsd.Decimal)
{
value = reader.Value.AsFloat();
}
else if (type == Xsd.QName)
{
value = reader.ValueAsXName();
}
else
{
value = reader.Value;
}
}
else if (reader.NodeType == XmlNodeType.Element)
{
reader.Skip();
}
else if (reader.NodeType == XmlNodeType.EndElement)
{
break;
}
}
return value;
}
示例3: ReadOption
public static Element ReadOption(XmlReader reader)
{
XName name = null;
if (reader.MoveToAttribute("name"))
name = reader.ValueAsXName();
XName constrained = null;
if (reader.MoveToAttribute("constrained"))
constrained = reader.ValueAsXName();
var element = new PrintSchemaOption(name, constrained);
foreach (var child in ReadChildren(reader))
{
element.Add(child);
}
return element.GetResult();
}