I'm working on a ruby on rails app that generates a large XML document using a builder template, but I've hit a bit of a stumbling point.
The XML output must have a field that contains the file size in bytes. I think that I'll basically need to use the value that would populate the "Content-Length" header in the http response, but updating the value of the tag will obviously change the file size.
The output should looks something like this:
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<metadata>
<filesize>FILESIZE</filesize>
<filename>FILENAME.xml</filename>
</metadata>
<data>
.
.
.
</data>
</dataset>
Is adding the file size in an XML tag possible using a builder template? If not, is there some method that I could use to achieve the required result?