Q:

How to convert a xml to binary data

I have a xml file.I want it to convert the content to binary in java.Please suggest me some solution.
<ematrix>

    <creationProperties>
    <release>V6R2013x.HF15(22.0.0.0)</release>
    <datetime>2015-07-13T12:04:16Z</datetime>
    <event>export</event>
    <dtdInfo>&ematrixProductDtd;</dtdInfo>
    </creationProperties>
    <businessObject id="20336.41905.24848.52076">
    <objectType>pgPLIAccessRole</objectType>
    <objectName>Vault Test</objectName>
    <objectRevision>-</objectRevision>
    <vaultRef>eService Production</vaultRef>
    <policyRef>pgPicklistItem</policyRef>
    <physicalid>94A50B1C3D0B0000436FAC548F9E0A00</physicalid>
    <logicalid>94A50B1C3D0B0000436FAC54909E0A00</logicalid>
    <cestamp>94A50B1C21530000EEBBAE542F4C0000</cestamp>
    <updatestamp>94A50B1C3D0B0000436FAC54989E0A00</updatestamp>
    <majorid>94A50B1C3D0B0000436FAC548F9E0A00</majorid>
    <versionid>94A50B1C3D0B0000436FAC54A89E0A00</versionid>
    <minororder>0</minororder>
    <majororder>0</majororder>
    </businessObject>

    </ematrix>`

A:

you may read the content of file and then can convert that content in binary 
see Java File to Binary Conversion

