Access to raw stanza?
As I understand, now it is not possible to get raw stanza (except in XmppDebugger) So it isn't possible to create server session, for example, because it needs to forward raw stanzas with all unknown elements. Am I missing something?
Comments (12)
-
repo owner -
reporter Marshaller will only serialize known elements, isn't it?
-
reporter E.g. I have <message><body /><some-unknown-extension xmlns="..."/></message> and unknown extension will be lost when I will try to serialize Message back to XML string
-
repo owner I think JAXB deserializes unknown elements as
org.w3c.dom.Element
and also serializesElement
to XML in a normal way. -
reporter True, thanks
-
reporter - changed status to resolved
-
reporter Marshalling with JAXB falling into this issue - http://stackoverflow.com/questions/1673626/jaxb-appending-unneeded-namespace-declarations-to-tags - any recommendations?
-
reporter - changed status to open
-
repo owner Use
XmppUtils.createXmppStreamWriter
to create anXMLStreamWriter
which doesn't write all these prefixes, like this:XMLStreamWriter xmppStreamWriter = null; try { xmppStreamWriter = XmppUtils.createXmppStreamWriter(xmppSession.getConfiguration().getXmlOutputFactory().createXMLStreamWriter(byteArrayOutputStream)); xmppSession.createMarshaller().marshal(element, xmppStreamWriter); xmppStreamWriter.flush(); } finally { if (xmppStreamWriter != null) { xmppStreamWriter.close(); } }
Here, an
XMLStreamWriter
is created from the session configuration, which is basicallyXMLOutputFactory.newFactory()
. The writer then writes (marshalls) to an OutputStream.Just curious, what you are trying to do?
-
reporter Worked awesome!
-
reporter - changed status to resolved
-
repo owner - changed status to closed
- Log in to comment
I am not sure, what you are trying to accomplish.
You can use XmppSession.createMarshaller() and then marshall any element into an XML String, if you need that.