Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loading xml
Message
De
07/01/2015 06:44:14
 
 
À
07/01/2015 06:32:43
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
C# 5.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01613141
Message ID:
01613235
Vues:
21
>>>>>>>Hu
>>>>>>>
>>>>>>>I asked a few question about loading some XML before Christmas (thanks for the replies)
>>>>>>>
>>>>>>>An additional question.
>>>>>>>
>>>>>>>The Web service I am getting codes from has a limit return size of 100 items.
>>>>>>>
>>>>>>>There are more than 100 items in the list so I need to make repeated calls wit an offset value to get a full list .
>>>>>>>
>>>>>>>My question is if I load the xml into a datatable how can I then add the subsequent xml to the same datatable.
>>>>>>>
>>>>>>>
>>>>>>>Thanks
>>>>>>
>>>>>>Can you remind me as to how the XML for the initial 100 items looks ?
>>>>>
>>>>>HI Viv
>>>>>
>>>>>this is the XML model
>>>>>
>>>>><ListItems>
>>>>>  <Items>
>>>>>    <ListItem>
>>>>>      <ID>string</ID>
>>>>>      <Level10Code>string</Level10Code>
>>>>>      <Level1Code>string</Level1Code>
>>>>>      <Level2Code>string</Level2Code>
>>>>>      <Level3Code>string</Level3Code>
>>>>>      <Level4Code>string</Level4Code>
>>>>>      <Level5Code>string</Level5Code>
>>>>>      <Level6Code>string</Level6Code>
>>>>>      <Level7Code>string</Level7Code>
>>>>>      <Level8Code>string</Level8Code>
>>>>>      <Level9Code>string</Level9Code>
>>>>>      <ListID>string</ListID>
>>>>>      <Name>string</Name>
>>>>>      <ParentID>string</ParentID>
>>>>>      <URI>string</URI>
>>>>>    </ListItem>
>>>>>  </Items>
>>>>>  <NextPage>string</NextPage>
>>>>></ListItems>
>>>>>
>>>>>The next page is a link to a url that will give the next page of codes.
>>>>>
>>>>>This is an example 
>>>>>
>>>>>https://implementation.concursolutions.com/api/v3.0/common/listitems?offset=gWjRylmbg2Q$sgk2ntXuSl591shOT1yOaB3Q&limit=100&listId=gWqmEUETdJu1SXJIJJCo6vYtHZaYn6QPrPA"
>>>>>
>>>>>
>>>>
>>>>Link gives 'unauthorized' but am I right in assuming that the XML identical except for the actual data ?
>>>
>>>Yes thats right.
>>
>>Sorry, can you also either provide a link to the original thread (or post your current code for handling this) ?
>
>Thanks Viv
>
>
>I'm not going to have to get the whole list after all as we are going to store the ID locally.
>
>The concur web service only allows you to update via the ID which is a guid but the only way to get the id for an item was to get the whole list. But as the id is returned when you add something I can store the id against the list item outside concur (if that all makes sense).

Makes sense. I was going to suggest building up one XMLDocument and using that for the datatable. Something like:
XmlDocument doc1 = GetFirstBatch();
            var dest = doc1.GetElementsByTagName("Items")[0];

            while (moreToGet)
            {
                XmlDocument doc2 = GetNextBatch();
                var v = doc2.GetElementsByTagName("ListItem");
                foreach (XmlNode xx in v)
                {
                    dest.AppendChild(doc1.ImportNode(xx, true));
                }
            }
//doc1 now has all <ListItem> elements
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform