Hi Ahmed,
Sorry I've not replied sooner.
No - you're not doing anything wrong, the codes just... broken. However, that being said - it's broken by design. When I first started HalBuilder my leaning was towards only support SIMPLE key/value pairs, and not arbitrarily nested data structures, mostly as a side effect of wanting to support round-tripping between the XML and JSON variants backwards and forwards.
There are many ways one could serialise nested objects in XML, but not everyone wants to work in the same way.
Currently, the XmlRepresentationWriter simply sets the #TEXT of an element to the .toString() of the value. Support for writing out nested objects was added to JSON awhile ago, and now that the JSON and XML variants have separate release cycles, and I'm not so much concerned with full round-tripping between JSON/XML we should be able to add support for this fairly easily.
The only thing I'm concerned about is how this breaks the interface based rendering/mapping of a representation to a class proxy - altho I'm also wondering if I should even keep support for that in the core library as well.