本文整理汇总了C#中System.Xml.XmlReader.XName方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.XName方法的具体用法?C# XmlReader.XName怎么用?C# XmlReader.XName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.XName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: ReadElement
public static Element ReadElement(XmlReader reader)
{
XName tagName = reader.XName();
if (tagName == Psf.Feature) return ReadFeature(reader);
else if (tagName == Psf.Option) return ReadOption(reader);
else if (tagName == Psf.ParameterDef) return ReadParameterDef(reader);
else if (tagName == Psf.ParameterInit) return ReadParameterInit(reader);
else if (tagName == Psf.ParameterRef) return ReadParameterRef(reader);
else if (tagName == Psf.Property) return ReadProperty(reader);
else if (tagName == Psf.ScoredProperty) return ReadScoredProperty(reader);
else if (tagName == Psf.Value) return ReadValue(reader);
else reader.Skip();
return null;
}
示例3: ReadTicket
public static Ticket ReadTicket(XmlReader reader)
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
break;
}
}
var tagName = reader.XName();
if (tagName != Psf.PrintTicket)
return null;
var pt = new PrintSchemaTicket();
pt.Add(ReadNamespaceDeclarations(reader));
foreach (var child in ReadChildren(reader))
{
pt.Add(child);
}
return pt.GetResult();
}
示例4: ReadCapabilities
public static Capabilities ReadCapabilities(XmlReader reader)
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
break;
}
}
var tagName = reader.XName();
if (tagName != Psf.PrintCapabilities)
return null;
var pc = new PrintSchemaCapabilities();
pc.Add(ReadNamespaceDeclarations(reader));
foreach (var child in ReadChildren(reader))
{
pc.Add(child);
}
return pc.GetResult();
}