Hi Gautam,
an XML is a byte[]. If you do a
byte[] bytes = ... try { String xml = new String(bytes, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
you have assumed it is UTF-8 encoded (which is the xml default and is advisable).
But usually you shouldn't do that. If you use a xml parser for the XML InputStream (from byte[]) it correctly detects the encoding of the xml by looking at the XML header
<?xml version="1.0" encoding="UTF-8"?>
To summarize: A byte[] is a perfect transport medium for xml,
Hi Marcel:
Thanks.
Gautam
Marcel
Gautam Thaker schrieb:Hi:
I am learning more about xmlBlaster by trying various demo programs and running small variations there off. I have run most of the "HelloWorldx.java" pgms and a few others. What I have found so far is that in all cases the content of the user information being sent is a byte array. The key and qos info are in XML, but the user payload is byte array. What I wish to do is to have my payload be a large XML document. (The receiver would have a schema against which it may check for validity before accepting/processing the message.)
Is there an example that shows how this is done? Or is it that in all cases the message content is byte array and all XML documents are simply byte arrays any way? (I am not an XML guru myself, sorry if this is a naive question over all.)
Gautam