Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6707117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:36:04+00:00 2026-05-26T07:36:04+00:00

I’m struggling with this problem for a week. I try to write a program

  • 0

I’m struggling with this problem for a week. I try to write a program in java that can edit ebooks. My choosed ebook format is fictionbook which contains its data in an xml like file. I can open this file and generate a sourceview in a JTextComponent. There are two togglebuttons in my editor preview and sourceview. They using the same JTextComponent for display. When the user clicks on the sourceview it display the choosen file source(plain xml). I generate the preview from this source by parsing the data i need to display.If i change something in the sourceview it will be displayed in the preview too because its generated from there, my problem is how can i made this backwards. So if i change something in preview it will change in the source too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:36:05+00:00Added an answer on May 26, 2026 at 7:36 am

    It’s kind of hard to see this as a JDOM-specific question. The underlying representation could be pretty much anything. Normally a preview is just that: a view of the end result that wouldn’t be directly editable. If you wish to be able to edit both the source and through a WYSIWYG view, you’ll need to investigate the model-view-controller pattern.

    The underlying XML would be your model. Both the XML editor view and the WYSIWYG view (your current preview) would then be views AND controllers. Currently this is only the case for your XML editor, whereas the preview is nothing but a view.

    Changing the underlying XML from the preview sounds difficult, unless each node can somehow be identified (like via an id attribute). You’ll need some additional underlying data in your preview to do this coupling in the other direction.

    I’m not certain a JDOM Document is the best model for your purposes. Maybe you’re better of using something like JAXB to have simple JavaBeans to represent the model which can then be marshalled to XML and unmarshalled from XML. So you get:

                        model: JavaBeans with JAXB annotations
                          ^
                          |
        (directly) +--------------------------------------+ (through JAXB)
                   |                                      |
    WYSIWYG editor: view + controller             XML editor: view + controller
    

    But that’s just my first impression. Investigate existing editors to find out good method for doing this. Maybe checking out IDE plugins/modules could be interesting, since IDEs typically allow multiple types of editors to change an underlying data model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.