Elements vs SDF objects

I am strugling with understanding the difference between e.g iterating through all elements on a page and addressing the resources dictionary.
I have seen in previous posts that you sometimes advice customers to step through all page content such as in the examples provided with the library.
and this allows the elements to be copied and new elements to be replaced for instance.

In my case i have to be able to replace images which belong to a certain xobject.
— xobject

  • resources

Would you recomend me using the elementwriter way of doing this, that is copying each element and in the case of it being an image, replacing this.
or would you recommend me to do xobj.findObject(“resources”) approach?

I hope you do understand what i am aiming at.