XmlElement request


Jules, I have a little unusual request: It would be great to be able to choose in which format XmlElement writes empty elements. Right now it writes them as:

which is the format I prefer, but I’d like the possibility to have it write the empty element as:

Maybe a :

class XmlElement { ... static bool uglyEmptyElementFormat; ... };
This is because I use boost (1.33.1) serialization to serialize the object structure and I need to preprocess the XML with JUCE which produces the latter empty element format. But boost::serialization chokes on the former format with an exception. Can you believe that? :shock:

I’ve filed a bug report to boost, but I suspect that version 1.45 of juce will hit the streets FAR before 1.35.1 of boost does…

Ps. No, boost 1.34.1 has the same problem… if anyone should ask that… :wink:


Yeah, I sympathise, but I wouldn’t really want to clutter up the code with that sort of thing, when what it’s doing is already correct. A quick solution might be to write your own version of writeElementAsText() by just copying mine and hacking it a bit?


Appreciate that, and subclassing XmlElement would be a good way, but I’m not sure how to make XmlDocument::getDocumentElement use my subclass instead of XmlElement when loading the XML document in the first place? Would require some hacking of that too…

And changing the code base itself is not a good option as I need to have it working without having to patch JUCE at each update…



No - I meant just write it as your own static function that takes an element pointer, rather than as a class method.


Ok! Will test that.