function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Incomplete HttpResponse - what's wrong with this picture?

Hello all.


This has me totally beaten, so any light anyone can shed upon it would be warmly received!


Here's the simplest example I can come up with:


Http h = new Http();
HttpRequest req = new HttpRequest();
HttpResponse res = h.send(req);
Xmldom d = new xmldom(res.getBody());
List<XMLDOM.Element> items = d.getElementsByTagName('Item');
System.Debug('Items in list:' + items.size());


Essentially: go and fetch an XML document, then put all the elements called <item> into a list.


In the example XML document I'm using, there are 27 <item> elements, so you'd expect the size of the list to be 27... but not so. It's 12. What's more, only the first 10 items in the list are retrieved from the XML - the last two are null.


So what on earth is all that about? And how do I retrieve the lot? Am I misusing "getElementsByTagName" or "getBody" or something?


Thanks in advance.