k1robert 0 Newbie Poster

Hi all please help as I am so stuck. My aim in to retrieve the information out of the xml soap file and store it in a database. However I havent got the slightes idea what i'm doing wrong. Please help I just want to write the values out in the console app in the first instance.

My XML

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<FixedPenaltyNotice xmlns="http://www.myScema.co.uk/schema">
<NotificationType>2100</NotificationType>
<VersionCreatedDatim>2011-07-12T00:00:00</VersionCreatedDatim>
    <NotificationComments>fdskjjhkkgfdgkdg
    </NotificationComments>
<Sender>
    <OrganisationID>5720</OrganisationID>
    <DistrictID>5</DistrictID>
</Sender>
<PrimaryRecipient>
    <OrganisationID>5720</OrganisationID>
    <DistrictID>4</DistrictID>
</PrimaryRecipient>
<WorksReference>7896697678</WorksReference>
<FPNdetails><FPNnumber>673257632</FPNnumber>
<FPNoffenceCode>2</FPNoffenceCode>
<FPNoffenceDate>2005-07-05</FPNoffenceDate>
<FPNlocation>Some location somewhere</FPNlocation>
<FPNauthorisedOfficerName>Joe Bloggs</FPNauthorisedOfficerName>
</FPNdetails>
</FixedPenaltyNotice>
</soap:Body>
</soap:Envelope>

My Code

  string file =@"C:\Dropbox\Unprocessed";


                        XNamespace soapNs = "http://www.w3.org/2003/05/soap-envelope";
                        XNamespace FPN = "http://www.myScema.co.uk/schema";

                        var penalties = from lst in XElement.Load(file).Elements(soapNs + "Body").Elements("FixedPenaltyNotice")

                                        select (string)lst.Attribute(FPN + "NotificationType");
                        foreach (var penalty in penalties)
                        {

                            Console.WriteLine(penalty);

                        }