I have parsong code for custom XMPP stanzas, it turns a raw XMPP String into a Java object. I currently have code (providers & co) that turns the parsed IQs and turns them back into a string so I can then use my parsers as-is, this is not optimal. I have lots of code for parsing my custom IQ stanzas and I really do not want to have to write it again for Smack nor have to maintain two sets. Is there a way to just get the raw string from smack without all the processing?
How does your parsing code turn the “raw” String into a Java object? It appears you should just abstract a little lower, e.g. just like Smack does, so instead of transforming a String to a POJO, transform a $Parser instance to a POJO. You can basically wrap the parser that Smack hands over to providers into any other parser (e.g. JABX). You could also transform it to a String in the provider and then into a POJO, but that sounds like bad design.
I actually use Tigase’s libs, it takes a String and outputs an “Element” which is a kind of map; I just take this and pass it to my transformers lib to create POJO. This is why I don’t really need to use the parser Smack uses but instead just get the raw String and pass it on to Tigase’s parsing lib and then to my transformers.
It uses this:XMPPDomBuilderHandler (Tigase XMPP Server 7.0.0 API) and hands it over to it’s parser with the char[], an offset and the length, here is an example usage: