Getting XML Header in XMLBeans

Discussion in 'Java' started by Gugle, Dec 20, 2006.

  1. Gugle

    Gugle Guest

    Hi All,
    I'm using XMLBeans for generating xml files. But it doesn't seem to be
    printing the XML Header line at the top - <?xml version="1.0"
    encoding="UTF-8"?>. Can someone tell me how to get XMLBeans to add this
    to the XML?
    Gugle, Dec 20, 2006
    1. Advertisements

  2. You can't - or rather, you should not. I guess that XMLBeans uses
    Reader and Writer (i.e. character streams) to read from and write to.
    It does not know the encoding of the stream. So you have to write it

    Robert Klemme, Dec 20, 2006
    1. Advertisements

  3. Gugle

    Gugle Guest

    But I'm setting the encoding type through the XMLOptions object as

    XmlOptions opts = new XmlOptions();
    //xmlDoc.documentProperties().setEncoding("UTF-8");, opts);

    Any idea if XMLBeans will use this value for adding the header?
    Gugle, Dec 20, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.