Results 1 to 10 of 10
Thread: [SOLVED] jTextPane to xml
- 04-14-2009, 03:19 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 6
- Rep Power
- 0
[SOLVED] jTextPane to xml
Hi!
I have a question, how to write the text and pictures from a JTextPane into a XML document?!
I can save the text and pictures from the JTextPane into a document but it not works with XML document:
private void doSave(File file) {
FileOutputStream fous = null;
{
ObjectOutputStream oos = null;
try {
fous = new FileOutputStream(file);
oos = new ObjectOutputStream(fous);
oos.writeUnshared(jTextPane_weather.getStyledDocum ent());
oos.flush();
} catch (IOException ex) {
//...
} finally {
try {
fous.close();
} catch (IOException ex) {
//...
}
try {
oos.close();
} catch (IOException ex) {
//...
}
}
}
}
- 04-14-2009, 08:14 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
My suggestion is, first of all try to workout a simple application to write some data into a XML file in Java. Read more about javax.xml.parsers API in Java.
- 04-14-2009, 08:57 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 6
- Rep Power
- 0
thanks!
I can write the XML.
But I can't write the "objects" into XML, for XML is plain text.
I just want to save the things from NINE jTextPanes into one file.
Without XML, how can I save them and parse the file?!
- 04-14-2009, 12:53 PM #4
Member
- Join Date
- Apr 2009
- Posts
- 6
- Rep Power
- 0
I'm really sorry.
I'm just new to java, and learned that .java-forums.org and forums.sun.com are both big java communities.
I have no idea where should I ask the question, so I post both.
If I have wasted your time, I'm really sorry and please accept my apology!
I will discuss the question:
"forums.sun.com/thread.jspa?threadID=5380152&tstart=0"
Thank you!
- 04-14-2009, 01:52 PM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 04-14-2009, 01:54 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Search the web, search our forum. You can find a lot. Here is one of them I've found on the web. Not exactly what you want, but if you can have an idea.
Serializing Java Objects as XML
- 04-14-2009, 02:28 PM #7
Member
- Join Date
- Apr 2009
- Posts
- 6
- Rep Power
- 0
Thank you very much!
"Cross-posting is not good."I will remember that!
I will discuss the problem at //forums.sun.com/forum.jspa?forumID=31&start=0
and also post the solution here.
Thanks for your suggestion, and it's my honor if you can join the discussion there!
- 04-14-2009, 04:42 PM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Sorry lol. I'm not a registered user on Suns' forum.
- 04-15-2009, 02:52 AM #9
Member
- Join Date
- Apr 2009
- Posts
- 6
- Rep Power
- 0
^o^ thank you anyway!
E-mail:shun.ps@gmail.com
- 04-15-2009, 04:46 AM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
If you are no longer deal with this thread, please mark it as solved.
Similar Threads
-
Clipboard and jTextPane
By Gudradain in forum AWT / SwingReplies: 11Last Post: 01-04-2009, 11:08 PM -
StyledDocument for JTextPane
By nadia in forum AWT / SwingReplies: 2Last Post: 12-28-2008, 02:41 AM -
JTextPane with servlets
By kinabaloo in forum Advanced JavaReplies: 2Last Post: 07-11-2008, 06:32 AM -
JTextPane Styles Example
By Java Tip in forum javax.swingReplies: 0Last Post: 06-27-2008, 07:48 PM -
Transparent JTextPane
By Ada in forum AWT / SwingReplies: 1Last Post: 05-31-2007, 09:50 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks