开发者

JAVA binding an XML to update a GUI and vice versa

I'm using JAXB to model a schema and wrap XML data in java classes. I created a GUI which represents the same schema as well. I want to bind the 2 together - meaning when ever the GUI is changed the XML data (Jaxb object) will reflect the changes, and when ever i read a XML file the gui will populate according to the xml nodes values. How can i connect between the 2? A pseudo code i'm trying to implement would look like:

  • Read_XML_Procedure:

Read XML file populate GUI gui.firstName = xml.firstName gui.lastName = xml.lastname ...

  • GUI side:

gui.entry.name = "john" => xml.name = "j开发者_高级运维ohn"

I don't want to have to write the parser manually because i have about 1000 different entries to populate. In a scripting language such as TK i know that entries can be attached to variables. when the variable is changed then the entry reflects that automatically Thanks


You may want to use JAXB binder here. This will let you make changes in XML and apply it to the object model, or changes in the object model and apply it to XML.

For more information:

  • http://bdoughan.blogspot.com/2010/09/jaxb-xml-infoset-preservation.html
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜