This is blowing up. It appears to only blow up if the Node has child nodes. Can someone tell me what I am doing wrong? (It blows up on the "Taxes" node).
PayoffQuote.cs
private void Fetch(Criteria crit)
{
int i = 0;
XmlDocument doc = new XmlDocument();
doc.Load("C:\\Clients\\FinanceSource\\FinanceSource.Library\\xml\\MockLease.xml");
XmlElement root = doc.DocumentElement;
XmlNode quoteInfo = root.ChildNodes[0];
foreach (XmlElement detail in quoteInfo.ChildNodes)
{
if(detail.Name == "QuoteDetail")
{
QuoteDetails.Add(i,new QuoteDetail(detail));
i += 1;
}
}
}
QuoteDetail.cs
public QuoteDetail(XmlElement detailNode)
{
int i = 0;
_title = detailNode.Attributes["Text"].Value;
if(detailNode.HasAttribute("Amount"))
{
_amount = double.Parse(detailNode.Attributes["Amount"].Value);
}
if(detailNode.HasChildNodes)
{
foreach (XmlElement detail in detailNode.ChildNodes)
{
QuoteDetails.Add(i,new QuoteDetail(detail));
i += 1;
}
MockLease.xml file:
<?
xml version="1.0" encoding="utf-8" ?>~james
I'm afraid I don't work with XML too often, but I will tell you there was a strange </font> tag in the email I received from your post. (I'm going say closing "font" element in case my text gets rendered as HTML) This font tag appears between the last quotedetail closing node and the quoteinformation closing node.
You also appear to have an extra closing node of QuoteDetail.
Perhaps your file isn't formed well.
Here's a cut and paste of the MockLease file as I saw it in my e-mail (assuming it shows properly)
<?xml version="1.0" encoding="utf-8" ?>
<PayoffQuote>
<QuoteInformation>
<QuoteDetail Text="Residual Value (Purchase Option Amount)" Amount="10585.00"/>
<QuoteDetail Text="Taxes">
<QuoteDetail Text="Sales Tax" Amount="10"/>
<QuoteDetail Text="Transport Tax" Amount="20"/>
<QuoteDetail Text="RipOff Tax" Amount="30.50"/>
</QuoteDetail>
< /FONT></QuoteInformation>
</PayoffQuote>
Copyright (c) Marimer LLC