本文整理汇总了C#中System.Xml.XmlReader.ReadElementContentAsDouble方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadElementContentAsDouble方法的具体用法?C# XmlReader.ReadElementContentAsDouble怎么用?C# XmlReader.ReadElementContentAsDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadElementContentAsDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessXmlCore
internal override void ProcessXmlCore (XmlReader reader)
{
switch (reader.Name) {
case "duration":
duration = TimeSpan.FromMilliseconds (reader.ReadElementContentAsDouble ());
break;
case "release-list":
if (reader.ReadToDescendant ("release")) {
List<Release> releases = new List<Release> ();
do releases.Add (new Release (reader.ReadSubtree ()));
while (reader.ReadToNextSibling ("release"));
this.releases = releases.AsReadOnly ();
}
break;
case "puid-list":
if (reader.ReadToDescendant ("puid")) {
List<string> puids = new List<string> ();
do puids.Add (reader["id"]);
while (reader.ReadToNextSibling ("puid"));
this.puids = puids.AsReadOnly ();
}
break;
default:
base.ProcessXmlCore (reader);
break;
}
}
示例2: ReadXml
public override void ReadXml(XmlReader reader)
{
complexParameters.Clear();
primitiveParameters.Clear();
reader.MoveToContent();
reader.ReadStartElement();
primitiveParameters.Add("DesiredValueStepSize", reader.ReadElementContentAsDouble());
primitiveParameters.Add("AllowedOscillationPercentage", reader.ReadElementContentAsDouble());
primitiveParameters.Add("GenerateSineWaveTestCases", reader.ReadElementContentAsBoolean());
primitiveParameters.Add("SineFrequency", reader.ReadElementContentAsDouble());
reader.ReadEndElement();
}
开发者ID:sac16controllertester,项目名称:ControllerTester,代码行数:16,代码来源:AllowedOscillationFaultModelConfiguration.cs
示例3: read
public override void read(XmlReader xr, string nameSpace)
{
this.Name = xr["Name", nameSpace];
xr.ReadStartElement(/* Electrode */);
this.X = xr.ReadElementContentAsDouble("X", nameSpace);
this.Y = xr.ReadElementContentAsDouble("Y", nameSpace);
this.Z = xr.ReadElementContentAsDouble("Z", nameSpace);
xr.ReadEndElement(/* Electrode */);
}
示例4: ReadXml
public override void ReadXml(XmlReader reader)
{
complexParameters.Clear();
primitiveParameters.Clear();
reader.MoveToContent();
reader.ReadStartElement();
primitiveParameters.Add("Regions", reader.ReadElementContentAsDouble());
primitiveParameters.Add("PointsPerRegion", reader.ReadElementContentAsDouble());
reader.MoveToFirstAttribute();
int cnt = Int32.Parse(reader.GetAttribute("Count"));
reader.ReadToFollowing("Requirement");
IList<string> requirements = new List<string>();
for (int i = 0; i < cnt; i++)
{
requirements.Add(reader.ReadElementContentAsString());
}
complexParameters.Add("Requirements", requirements);
reader.ReadEndElement();
primitiveParameters.Add("UseAdaptiveRandomSearch", reader.ReadElementContentAsBoolean());
primitiveParameters.Add("OptimizationAlgorithm", reader.ReadElementContentAsString());
reader.ReadEndElement();
}
示例5: 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.ReadElementContentAsDateTime();
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
return node;
}
示例6: ReadXml
public void ReadXml(XmlReader reader)
{
reader.MoveToContent();
reader.ReadStartElement();
_id = reader.ReadElementContentAsInt("Id", reader.NamespaceURI);
_model = (BoatModel)reader.ReadElementContentAsInt("Model", reader.NamespaceURI);
_length = reader.ReadElementContentAsDouble("Length", reader.NamespaceURI);
reader.ReadEndElement();
}
示例7: ReadXml
public override void ReadXml(XmlReader reader)
{
Value = reader.ReadElementContentAsDouble();
}
示例8: ReadXml
/// <summary>
/// Helper function to read an XML element (not a full document)
/// representing a cloud execution report.
/// </summary>
/// <remarks>
/// Note that the XmlReader is expected to be positioned in the XML
/// document such that the current node is a report element.
/// </remarks>
/// <param name="xr">The XmlReader object to read from.</param>
/// <returns>
/// A new report corresponding to the XML representation read.
/// </returns>
public static CloudExecutionReport ReadXml(XmlReader xr)
{
Util.Assert(xr.Name.Equals(CloudExecutionReport.XmlTag));
string versionText = xr.GetAttribute(CloudExecutionReport.XmlVersionAttribute);
int version = int.Parse(versionText, CultureInfo.InvariantCulture);
string identifier = string.Empty;
StatusCode status = StatusCode.Completed;
string processingNode = "Unknown Benevolence";
int exitCode = 0;
string standardOutput = string.Empty;
string standardError = string.Empty;
double cpuTime = 0;
bool inOutputFileMappings = false;
List<BuildObjectValuePointer> outputFileMappings = new List<BuildObjectValuePointer>();
List<BuildObject> outputFiles = new List<BuildObject>();
while (xr.Read())
{
if (xr.NodeType == XmlNodeType.Element)
{
switch (xr.Name)
{
case XmlIdentifierElement:
identifier = xr.ReadElementContentAsString();
break;
case XmlStatusElement:
status = (StatusCode)Enum.Parse(typeof(StatusCode), xr.ReadElementContentAsString());
break;
case XmlProcessingNodeElement:
processingNode = xr.ReadElementContentAsString();
break;
case XmlExitCodeElement:
exitCode = xr.ReadElementContentAsInt();
break;
case XmlStandardOutputElement:
standardOutput = xr.ReadElementContentAsString();
break;
case XmlStandardErrorElement:
standardError = xr.ReadElementContentAsString();
break;
case XmlCpuTimeElement:
cpuTime = xr.ReadElementContentAsDouble();
break;
case XmlOutputFileMappingsElement:
inOutputFileMappings = true;
break;
case BuildObjectValuePointer.XmlTag:
Util.Assert(inOutputFileMappings);
outputFileMappings.Add(BuildObjectValuePointer.ReadXml(xr));
break;
}
}
else if (xr.NodeType == XmlNodeType.EndElement)
{
if (xr.Name.Equals(CloudExecutionReport.XmlTag))
{
break; // All done.
}
switch (xr.Name)
{
case XmlOutputFileMappingsElement:
inOutputFileMappings = false;
break;
}
}
}
// REVIEW: Require element presence? Sanity check things here?
return new CloudExecutionReport(
version,
identifier,
status,
processingNode,
exitCode,
standardOutput,
standardError,
cpuTime,
outputFileMappings);
//.........这里部分代码省略.........
示例9: 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;
}
示例10: HandleConversion
private void HandleConversion(XmlReader reader, ref double scale, ref double preOffset, ref double postOffset)
{
bool noRead = false;
while (noRead || reader.Read()) {
noRead = false;
if (reader.NodeType == XmlNodeType.EndElement) {
if (reader.LocalName == "conversion")
return;
}
else if (reader.NodeType == XmlNodeType.Element) {
if (reader.LocalName == "scale") {
scale = reader.ReadElementContentAsDouble();
noRead = true;
}
else if (reader.LocalName == "offset") {
string prePost = reader.GetAttribute("order");
if (prePost == "pre")
preOffset = reader.ReadElementContentAsDouble();
else if (prePost == "post")
postOffset = reader.ReadElementContentAsDouble();
else
throw new InvalidOperationException();
noRead = true;
}
}
}
}
示例11: Load
/// <summary>
/// Creates an instance of the main diagnostic config object from an XmlReader
/// </summary>
internal static AnalyticsConfig Load(XmlReader reader)
{
if (reader == null)
throw new ArgumentNullException("reader");
var result = new AnalyticsConfig();
result.LatencyAlertThreshold = null;
reader.GoToElement();
reader.ReadStartElement();
if (!reader.IsEmptyElement)
{
while (reader.GoToSibling())
{
switch (reader.LocalName)
{
case "AdditionalData":
result.AdditionalData = reader.ReadElementContentAsString().Split(',').Select(kvp => kvp.Split('=')).ToDictionary(kvp => kvp[0], kvp => kvp[1]);
break;
case "Logging":
if (!reader.IsEmptyElement)
{
result.LoggingConfig = LoggingConfig.Load(reader);
}
else reader.Skip();
break;
case "Diagnostics":
if (!reader.IsEmptyElement)
{
reader.ReadStartElement();
while (reader.GoToSibling())
{
switch (reader.LocalName)
{
case "TrackQuality":
result.TrackQuality = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "TrackDownloadErrors":
result.TrackDownloadErrors = Convert.ToBoolean(reader.ReadElementContentAsInt());
break;
case "AggregationIntervalMilliseconds":
result.AggregationInterval = TimeSpan.FromMilliseconds(reader.ReadElementContentAsInt());
break;
case "PollingMilliseconds":
result.PollingInterval = TimeSpan.FromMilliseconds(reader.ReadElementContentAsInt());
break;
case "LatencyAlertThreshold":
result.LatencyAlertThreshold = reader.ReadElementContentAsDouble();
break;
case "QualityTracking":
result.QualityConfig = QualityConfig.Load(reader);
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
}
else
reader.Skip();
break;
default:
reader.Skip();
break;
}
}
reader.ReadEndElement();
}
else
reader.Skip();
return result;
}
示例12: ReadXml
public virtual void ReadXml(XmlReader reader)
{
Position = Position.ReadXml(reader);
Name = reader.ReadElementContentAsString();
CT = reader.ReadElementContentAsInt();
m_uniqueID = reader.ReadElementContentAsInt();
m_ctIncreaseModifier = reader.ReadElementContentAsDouble();
m_ctCostModifierToMove = reader.ReadElementContentAsDouble();
m_ctCostModifierToAct = reader.ReadElementContentAsDouble();
ListSerialization.ReadListFromXML(
reader,
innerReader =>
{
string typeName = reader.ReadElementContentAsString();
bool longTerm = Boolean.Parse(reader.ReadElementContentAsString());
IStatusEffectCore effect = EffectFactory.CreateEffectBaseObject(typeName, longTerm);
effect.ReadXml(reader);
AddEffect(effect);
});
}
示例13: ReadField
public override object ReadField(XmlReader xmlReader)
{
return xmlReader.ReadElementContentAsDouble();
}
示例14: ReadXml
public void ReadXml(XmlReader reader)
{
bool isEmpty = reader.IsEmptyElement;
reader.ReadStartElement();
if (isEmpty)
return;
while (reader.NodeType == XmlNodeType.Element || reader.NodeType == XmlNodeType.Text)
{
if (reader.IsStartElement("title"))
Title = reader.ReadElementString();
else if (reader.IsStartElement("exploration"))
Exploration = reader.ReadElementString();
else if (reader.IsStartElement("alias"))
Alias = reader.ReadElementString();
else if (reader.IsStartElement("grade"))
Grade = reader.ReadElementContentAsInt();
else if (reader.IsStartElement("upper_grade"))
UpperGrade = reader.ReadElementContentAsInt();
else if (reader.IsStartElement("length"))
Length = reader.ReadElementContentAsDouble();
else if (reader.IsStartElement("warning"))
Warning = reader.ReadElementString();
else
reader.ReadOuterXml();
}
reader.ReadEndElement();
}
示例15: ReadXml
private void ReadXml(XmlReader r)
{
try
{
double bid, ask, high, low;
DateTime date;
RateDirection direction;
if (r.MoveToAttribute("Symbol")) { symbol = r.Value; }
r.Read();
r.Read();
bid = r.ReadElementContentAsDouble("Bid", ""); r.Read();
ask = r.ReadElementContentAsDouble("Ask", ""); r.Read();
high = r.ReadElementContentAsDouble("High", ""); r.Read();
low = r.ReadElementContentAsDouble("Low", ""); r.Read();
direction = (RateDirection)r.ReadElementContentAsInt("Direction", ""); r.Read();
date = r.ReadElementContentAsDateTime("Last", ""); r.Read();
r.Read();
RateData tempData = new RateData(bid, ask, high, low, date, direction);
data.Add(tempData);
}
catch (Exception e) { throw e; }
}