The easiest way to encode the data you need is to use the Collections facility.
In the object properties box simply select Collection Data in the "Apply to" drop-down list and then create a new collection.
In the Collection Editor you can select only the fields you need to be encoded into the Barcode.
Keep in mind that although this is the easiest method it may not work well for very large forms with multiple pages & barcodes. For larger forms you will need to customize your own code. In that case I don't recommend modifying the generated script. Start from scratch.
-On another note what I would highly recommend not encoding XML directly into the Barcode itself. You would be best to encode the data in a delimited format and then convert that data to XML on the backend. XML takes up a great deal of space inside the barcode.