Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2006

Tip: Looking for answers? Try searching our database.

Getting XML Header in XMLBeans

Thread view: 
Gugle - 20 Dec 2006 10:16 GMT
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?
Robert Klemme - 20 Dec 2006 10:29 GMT
> 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?

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
yourself.

    robert
Gugle - 20 Dec 2006 10:40 GMT
But I'm setting the encoding type through the XMLOptions object as
follows:

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

Any idea if XMLBeans will use this value for adding the header?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.