本文整理汇总了C#中System.Xml.XmlReader.ReadElementContentAsNullable方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadElementContentAsNullable方法的具体用法?C# XmlReader.ReadElementContentAsNullable怎么用?C# XmlReader.ReadElementContentAsNullable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadElementContentAsNullable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseXml
internal static MarketplaceAppOfferNode ParseXml(XmlReader reader)
{
var node = new MarketplaceAppOfferNode();
reader.ReadStartElement();
while (reader.NodeType != XmlNodeType.EndElement)
{
switch (reader.LocalName)
{
case "offerId":
node.OfferId = reader.ReadElementContentAsUrn();
break;
case "mediaInstanceId":
node.MediaInstanceId = reader.ReadElementContentAsUrn();
break;
case "clientTypes":
node.ClientTypes = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
break;
case "paymentTypes":
node.PaymentTypes = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
break;
case "store":
node.Store = reader.ReadElementContentAsString();
break;
case "price":
node.Price = reader.ReadElementContentAsDouble();
break;
case "displayPrice":
node.DisplayPrice = reader.ReadElementContentAsString();
break;
case "priceCurrencyCode":
node.PriceCurrencyCode = reader.ReadElementContentAsString();
break;
case "licenseRight":
node.LicenseRight = reader.ReadElementContentAsString();
break;
case "expiration":
node.Expiration = reader.ReadElementContentAsNullable<DateTime>();
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
return node;
}
示例2: ParseXml
internal static WindowsPhoneStoreServiceAppNode ParseXml(XmlReader reader)
{
var node = new WindowsPhoneStoreServiceAppNode();
reader.ReadStartElement();
while (reader.NodeType != XmlNodeType.EndElement)
{
switch (reader.Name)
{
case "a:updated":
node.Updated = reader.ReadElementContentAsNullable<DateTime>();
break;
case "a:title":
node.Title = reader.ReadElementContentAsString();
break;
case "a:id":
node.Id = reader.ReadElementContentAsUrn();
break;
case "a:content":
node.Content = WindowsPhoneStoreServiceAppContentNode.ParseXml(reader);
break;
case "iapCount":
node.IapCount = reader.ReadElementContentAsInt();
break;
case "userRatingCountDistributions":
node.UserRatingCountDistributions = WindowsPhoneStoreServiceAppRatingsDistributionsNode.ParseXml(reader);
break;
case "sortTitle":
node.SortTitle = reader.ReadElementContentAsString();
break;
case "releaseDate":
node.ReleaseDate = reader.ReadElementContentAsNullable<DateTime>();
break;
case "visibilityStatus":
node.VisibilityStatus = reader.ReadElementContentAsString();
break;
case "publisher":
node.Publisher = reader.ReadElementContentAsString();
break;
case "averageUserRating":
node.AverageUserRating = reader.ReadElementContentAsDouble();
break;
case "userRatingCount":
node.UserRatingCount = reader.ReadElementContentAsInt();
break;
case "image":
node.Image = WindowsPhoneStoreServiceAppImageNode.ParseXml(reader);
break;
case "screenshots":
node.Screenshots = reader.ReadElementContentAsArray(WindowsPhoneStoreServiceAppImageNode.ParseXml);
break;
case "categories":
node.Categories = reader.ReadElementContentAsArray(WindowsPhoneStoreServiceAppCategoryNode.ParseXml);
break;
case "tags":
node.Tags = reader.ReadElementContentAsArray(x => x.ReadElementContentAsString());
break;
case "taxString":
node.TaxString = reader.ReadElementContentAsString();
break;
case "backgroundImage":
node.BackgroundImage = WindowsPhoneStoreServiceAppImageNode.ParseXml(reader);
break;
case "offers":
node.Offers = reader.ReadElementContentAsArray(WindowsPhoneStoreServiceAppOfferNode.ParseXml);
break;
case "publisherId":
node.PublisherId = reader.ReadElementContentAsString();
break;
case "publisherGuid":
node.PublisherGuid = reader.ReadElementContentAsUrn();
break;
case "a:entry":
node.Entry = WindowsPhoneStoreServiceAppEntryNode.ParseXml(reader);
break;
case "isUniversal":
node.IsUniversal = reader.ReadElementContentAsBoolean();
//.........这里部分代码省略.........
示例3: ParseXml
internal static WindowsStoreServiceAppPackageNode ParseXml(XmlReader reader)
{
var node = new WindowsStoreServiceAppPackageNode();
reader.ReadStartElement();
while (reader.NodeType != XmlNodeType.EndElement)
{
switch (reader.Name)
{
case "I":
node.Id = reader.ReadElementContentAsString();
break;
case "R":
node.ReleaseId = reader.ReadElementContentAsString();
break;
case "Pfn":
node.FamilyName = reader.ReadElementContentAsString();
break;
case "L":
node.Language = reader.ReadElementContentAsString();
break;
case "T":
node.Title = reader.ReadElementContentAsString();
break;
case "Ico":
node.Icon = reader.ReadElementContentAsString();
break;
case "Bg":
node.BackgroundColor = reader.ReadElementContentAsString();
break;
case "Fg":
node.ForegroundColor = reader.ReadElementContentAsString();
break;
case "Cs":
node.CurrencySymbol = reader.ReadElementContentAsString();
break;
case "Cc":
node.Currency = reader.ReadElementContentAsString();
break;
case "P":
node.Price = reader.ReadElementContentAsDouble();
break;
case "C":
node.Category = WindowsStoreServiceAppCategoryNode.ParseXml(reader);
break;
case "Sc":
node.SubCategory = WindowsStoreServiceAppCategoryNode.ParseXml(reader);
break;
case "Lud":
node.LastUpdate = reader.ReadElementContentAsNullable<DateTime>();
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
return node;
}