none
how can I read the whole data in xml parsing using c# RRS feed

  • Question

  • <?xml version="1.0" encoding="UTF-16"?>

    -<Records count="7">


    -<Metadata>


    -<FieldDefinitions>

    <FieldDefinition alias="Tracking_ID" name="Tracking ID" guid="2ba37d7a-e74f-49ad-9e20-aa2beb290695" id="31371"/>

    <FieldDefinition alias="Title" name="Title" guid="cf6183df-19c9-492a-b53a-cc4eb1dc8a16" id="31374"/>

    <FieldDefinition alias="Description" name="Description" guid="4220cccd-64f2-4db4-8ee6-6d2eb5a728c5" id="31375"/>

    </FieldDefinitions>

    </Metadata>


    -<LevelCounts>

    <LevelCount count="7" guid="984facc4-3dbe-4bd7-b3e1-fcc370d06d1d" id="4696"/>

    </LevelCounts>


    -<Record parentId="0" moduleId="4887" levelGuid="984facc4-3dbe-4bd7-b3e1-fcc370d06d1d" levelId="4696" contentId="222486">

    <Field guid="2ba37d7a-e74f-49ad-9e20-aa2beb290695" id="31371" type="6">222486</Field>

    <Field guid="cf6183df-19c9-492a-b53a-cc4eb1dc8a16" id="31374" type="1">This is also new value</Field>

    <Field guid="4220cccd-64f2-4db4-8ee6-6d2eb5a728c5" id="31375" type="1">This is new data from API function</Field>

    </Record>


    -<Record parentId="0" moduleId="4887" levelGuid="984facc4-3dbe-4bd7-b3e1-fcc370d06d1d" levelId="4696" contentId="222487">

    <Field guid="2ba37d7a-e74f-49ad-9e20-aa2beb290695" id="31371" type="6">222487</Field>

    <Field guid="cf6183df-19c9-492a-b53a-cc4eb1dc8a16" id="31374" type="1">This is also new value</Field>

    <Field guid="4220cccd-64f2-4db4-8ee6-6d2eb5a728c5" id="31375" type="1">This is new data from API function</Field>

    </Record>


    -<Record parentId="0" moduleId="4887" levelGuid="984facc4-3dbe-4bd7-b3e1-fcc370d06d1d" levelId="4696" contentId="222490">

    <Field guid="2ba37d7a-e74f-49ad-9e20-aa2beb290695" id="31371" type="6">222490</Field>

    <Field guid="cf6183df-19c9-492a-b53a-cc4eb1dc8a16" id="31374" type="1">This is also new value</Field>

    <Field guid="4220cccd-64f2-4db4-8ee6-6d2eb5a728c5" id="31375" type="1">This is new data from API function</Field>

    </Record>


    -<Record parentId="0" moduleId="4887" levelGuid="984facc4-3dbe-4bd7-b3e1-fcc370d06d1d" levelId="4696" contentId="222491">

    <Field guid="2ba37d7a-e74f-49ad-9e20-aa2beb290695" id="31371" type="6">222491</Field>

    <Field guid="cf6183df-19c9-492a-b53a-cc4eb1dc8a16" id="31374" type="1">This is also new value</Field>

    <Field guid="4220cccd-64f2-4db4-8ee6-6d2eb5a728c5" id="31375" type="1">This is new data from API function</Field>

    </Record>


    -<Record parentId="0" moduleId="4887" levelGuid="984facc4-3dbe-4bd7-b3e1-fcc370d06d1d" levelId="4696" contentId="222492">

    <Field guid="2ba37d7a-e74f-49ad-9e20-aa2beb290695" id="31371" type="6">222492</Field>

    <Field guid="cf6183df-19c9-492a-b53a-cc4eb1dc8a16" id="31374" type="1">This is also new value</Field>

    <Field guid="4220cccd-64f2-4db4-8ee6-6d2eb5a728c5" id="31375" type="1">This is new data from API function</Field>

    </Record>


    -<Record parentId="0" moduleId="4887" levelGuid="984facc4-3dbe-4bd7-b3e1-fcc370d06d1d" levelId="4696" contentId="222493">

    <Field guid="2ba37d7a-e74f-49ad-9e20-aa2beb290695" id="31371" type="6">222493</Field>

    <Field guid="cf6183df-19c9-492a-b53a-cc4eb1dc8a16" id="31374" type="1">This is also new value</Field>

    <Field guid="4220cccd-64f2-4db4-8ee6-6d2eb5a728c5" id="31375" type="1">This is new data from API function</Field>

    </Record>


    -<Record parentId="0" moduleId="4887" levelGuid="984facc4-3dbe-4bd7-b3e1-fcc370d06d1d" levelId="4696" contentId="222494">

    <Field guid="2ba37d7a-e74f-49ad-9e20-aa2beb290695" id="31371" type="6">222494</Field>

    <Field guid="cf6183df-19c9-492a-b53a-cc4eb1dc8a16" id="31374" type="1">This is also new value</Field>

    <Field guid="4220cccd-64f2-4db4-8ee6-6d2eb5a728c5" id="31375" type="1">This is new data from API function</Field>

    </Record>

    </Records>
    Tuesday, March 6, 2018 2:30 PM

All replies

  • Hi Gourav Narula,

    Thank you for posting here.

    For your question, if you want to read xml using parse, you could try the code below.

     XElement contacts = XElement.Parse(
        @"<?xml version=""1.0"" encoding=""UTF - 16""?>
    <Records count = ""7"">
       <Metadata>
         <FieldDefinitions>
           <FieldDefinition alias = ""Tracking_ID"" name = ""Tracking ID"" guid = ""2ba37d7a-e74f-49ad-9e20-aa2beb290695"" id = ""31371""/>
           <FieldDefinition alias = ""Title"" name = ""Title"" guid = ""cf6183df-19c9-492a-b53a-cc4eb1dc8a16"" id = ""31374""/>
           <FieldDefinition alias = ""Description"" name = ""Description"" guid = ""4220cccd-64f2-4db4-8ee6-6d2eb5a728c5"" id = ""31375""/>
         </FieldDefinitions>
       </Metadata>
       <LevelCounts>
           <LevelCount count = ""7"" guid = ""984facc4-3dbe-4bd7-b3e1-fcc370d06d1d"" id = ""4696""/>
       </LevelCounts>
       <Record parentId = ""0"" moduleId = ""4887"" levelGuid = ""984facc4-3dbe-4bd7-b3e1-fcc370d06d1d"" levelId = ""4696"" contentId = ""222486"">
           <Field guid = ""2ba37d7a-e74f-49ad-9e20-aa2beb290695"" id = ""31371"" type = ""6"" > 222486 </Field>
           <Field guid = ""cf6183df-19c9-492a-b53a-cc4eb1dc8a16"" id = ""31374"" type = ""1"" > This is also new value</Field>
           <Field guid = ""4220cccd-64f2-4db4-8ee6-6d2eb5a728c5"" id = ""31375"" type = ""1"" > This is new data from API function</Field>       
       </Record>
       <Record parentId = ""0"" moduleId = ""4887"" levelGuid = ""984facc4-3dbe-4bd7-b3e1-fcc370d06d1d"" levelId = ""4696"" contentId = ""222487"">
           <Field guid = ""2ba37d7a-e74f-49ad-9e20-aa2beb290695"" id = ""31371"" type = ""6"" > 222487 </Field>
           <Field guid = ""cf6183df-19c9-492a-b53a-cc4eb1dc8a16"" id = ""31374"" type = ""1"" > This is also new value</Field>
           <Field guid = ""4220cccd-64f2-4db4-8ee6-6d2eb5a728c5"" id = ""31375"" type = ""1"" > This is new data from API function</Field>    
       </Record>
       <Record parentId = ""0"" moduleId = ""4887"" levelGuid = ""984facc4-3dbe-4bd7-b3e1-fcc370d06d1d"" levelId = ""4696"" contentId = ""222490"">
           <Field guid = ""2ba37d7a-e74f-49ad-9e20-aa2beb290695"" id = ""31371"" type = ""6"" > 222490 </Field>
           <Field guid = ""cf6183df-19c9-492a-b53a-cc4eb1dc8a16"" id = ""31374"" type = ""1"" > This is also new value</Field>
           <Field guid = ""4220cccd-64f2-4db4-8ee6-6d2eb5a728c5"" id = ""31375"" type = ""1"" > This is new data from API function</Field>         
       </Record>
       <Record parentId = ""0"" moduleId = ""4887"" levelGuid = ""984facc4-3dbe-4bd7-b3e1-fcc370d06d1d"" levelId = ""4696"" contentId = ""222491"">
           <Field guid = ""2ba37d7a-e74f-49ad-9e20-aa2beb290695"" id = ""31371"" type = ""6"" > 222491 </Field>
           <Field guid = ""cf6183df-19c9-492a-b53a-cc4eb1dc8a16"" id = ""31374"" type = ""1"" > This is also new value</Field>
           <Field guid = ""4220cccd-64f2-4db4-8ee6-6d2eb5a728c5"" id = ""31375"" type = ""1"" > This is new data from API function</Field>         
       </Record>
       <Record parentId = ""0"" moduleId = ""4887"" levelGuid = ""984facc4-3dbe-4bd7-b3e1-fcc370d06d1d"" levelId = ""4696"" contentId = ""222492"">
           <Field guid = ""2ba37d7a-e74f-49ad-9e20-aa2beb290695"" id = ""31371"" type = ""6"" > 222492 </Field>
           <Field guid = ""cf6183df-19c9-492a-b53a-cc4eb1dc8a16"" id = ""31374"" type = ""1"" > This is also new value</Field>
           <Field guid = ""4220cccd-64f2-4db4-8ee6-6d2eb5a728c5"" id = ""31375"" type = ""1"" > This is new data from API function</Field>
       </Record>
       <Record parentId = ""0"" moduleId = ""4887"" levelGuid = ""984facc4-3dbe-4bd7-b3e1-fcc370d06d1d"" levelId = ""4696"" contentId = ""222493"">
           <Field guid = ""2ba37d7a-e74f-49ad-9e20-aa2beb290695"" id = ""31371"" type = ""6"" > 222493 </Field>
           <Field guid = ""cf6183df-19c9-492a-b53a-cc4eb1dc8a16"" id = ""31374"" type = ""1"" > This is also new value</Field>
           <Field guid = ""4220cccd-64f2-4db4-8ee6-6d2eb5a728c5"" id = ""31375"" type = ""1"" > This is new data from API function</Field>         
       </Record>
       <Record parentId = ""0"" moduleId = ""4887"" levelGuid = ""984facc4-3dbe-4bd7-b3e1-fcc370d06d1d"" levelId = ""4696"" contentId = ""222494"">
           <Field guid = ""2ba37d7a-e74f-49ad-9e20-aa2beb290695"" id = ""31371"" type = ""6"" > 222494 </Field>
           <Field guid = ""cf6183df-19c9-492a-b53a-cc4eb1dc8a16"" id = ""31374"" type = ""1"" > This is also new value</Field>
           <Field guid = ""4220cccd-64f2-4db4-8ee6-6d2eb5a728c5"" id = ""31375"" type = ""1"" > This is new data from API function</Field>         
       </Record>
       </Records>");
                Console.WriteLine(contacts);
                Console.ReadKey();

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 7, 2018 1:40 AM
    Moderator