Richard Love

Richard Love

  • NA
  • 26
  • 568

Nested XML to Excel or SQL Server Database

Aug 8 2018 4:36 AM
Hi all,
 
I'm very new to .NET and programming. Hopefully, someone can help.
 
I'm building a WPF MVVM project. I have a API Get, POST and PUT request. The response is in XML and I need to convert this XML to EXCEL. or store it in a Sql Server Database and then export it. 
 
I've tried multiple solutions but they don't get me through to ALL childNodes in the XML. Also, I need to convert the EXCEL back to XML and POST to the API. 
 
Here's a sample of the XML response. As you can see: a Goal Item contains a GoalTask, which contains a GoalTaskItem, which contains Description,StartDate and so on.
 
 
 
<ClientApi xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Validations i:nil="true" />
<status>200</status>
<timeStamp>2018-08-07T12:19:04+0000</timeStamp>
<totalRecords>5</totalRecords>
<data xmlns:a="www.API.com/Services">
<a:GoalItem>
   <a:GoalId>3</a:GoalId>
   <a:UserId>X</a:UserId>
   <a:ManagerId>X1</a:ManagerId>   
   <a:Title>test goal 2 x103340</a:Title>
   <a:Description>test description</a:Description>
   <a:StartDate>2018-07-24T00:00:00+0000</a:StartDate>
   <a:TargetDate>2018-12-31T23:59:00+0000</a:TargetDate>
   <a:Weight>10.00</a:Weight>
   <a:Progress>0</a:Progress>
   <a:Perspective>Individual Sales KPI</a:Perspective>
   <a:Status>On Track</a:Status>
   <a:GoalType>My Goals</a:GoalType>
   <a:AllowOtherUsersToSeeAndAlignWithThisGoal>False</a:AllowOtherUsersToSeeAndAlignWithThisGoal>
   <a:GoalCategories />
   <a:GoalTasks>
      <a:GoalTaskItem>
         <a:Description>Task escription</a:Description>
         <a:StartDate>2018-07-24T00:00:00+0000</a:StartDate>
         <a:DueDate>2018-12-31T23:59:00+0000</a:DueDate>
         <a:Weight>60.00</a:Weight>
         <a:Progress>0</a:Progress>
      </a:GoalTaskItem>
   </a:GoalTasks>
   <a:GoalTargets>
      <a:GoalTargetItem>
         <a:Description>target</a:Description>
         <a:StartDate>2018-07-24T00:00:00+0000</a:StartDate>
         <a:DueDate>2018-12-31T23:59:00+0000</a:DueDate>
         <a:Type>Number</a:Type>
      </a:GoalTargetItem>
   </a:GoalTargets>
   <a:GoalAssignment i:nil="true" />
   <a:GoalComments />
 </a:GoalItem>
</data>
</ClientApi>
 

Answers (1)