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
VintaraVintara 

Access XML document stored as static resource or other in Apex?

I'm looking for a way to store a large set of static data to be accessed in Apex. Using a custom object and records is problematic since the total datasize reaches 50mb in object form (much smaller as text or xml) and there is no good means of distrabution. Can an XML document stored in a static resource or another storage medium (document?) be accessed in Apex to be passed into am XML doc parser?

bob_buzzardbob_buzzard

I'm currently storing data in csv files as attachments to records (contacts/accounts) which I then access from Apex.  There's a limit of 5Mb per attachment, but its easy enough to iterate all the attachments.

 

 

diodio

Could you please show us the code on how to read the static resource please?


bob_buzzard wrote:

I'm currently storing data in csv files as attachments to records (contacts/accounts) which I then access from Apex.  There's a limit of 5Mb per attachment, but its easy enough to iterate all the attachments.

 

 


 

bob_buzzardbob_buzzard

An exceptionally late reply, but I didn't have code to access a static resource from Apex - in fact I don't believe that's possible.  My mechanism was to store the data as attachments against a record and display that via a Visualforce page.