tags:

views:

72

answers:

1

I need to produce the following xml packet to post to hudson. The log xml item will essentially have lines of console output. Can anyone help with the ColdFusion/Java to correctly encode that item

<run>
  <log encoding='hexBinary'>...hex binary encoded console output...</log>
  <result>... integer indicating the error code. 0 is success and everything else is failure</result>
  <duration>... milliseconds it took to execute this run ...</duration>
</run>
A: 

use <CFXML> tag would be the easiest way to construct a XML object in CFML.

hexBinary can be encoded using: BinaryEncode(yourBinaryData, "Hex")

<cftimer> can be used to measure the time took to execute the section of code in between the tags. Or GetTickCount()

Henry
You can't use BinaryEncode on a string. I have a string that I need to encode to form the log key data.
Stewart Robinson
Not sure what you're after, but does the toBase64(...) function do what you want?
Peter Boughton
hmm.. read the example at the bottom of http://www.cfquickdocs.com/cf8/#ToBinary
Henry