@Aki
I would have document A made as an xml document, use simplexml (php) to manipulate it and output the manipulated file in the specified intervals. The outputted file can also be an xml or a text file since you mentioned no databases...
Peni mbili zangu.