XML to Swing

I have a problem. I would like to realize a dynamic Swing-Application. The idea is to create a XML-Document and than to build a (simple) Swing-Gui. The question is: has somebody a similar example?ThanksEduard
[236 byte] By [EduardW] at [2007-9-26 1:46:49]
# 1
What do you mean ? Compose a form dynamically from a XML file ? I do think it's possible, but designing such a system would need quite a lot of work. A XML format describing forms should be developed. Any projects around ?
igarn at 2007-6-29 2:45:05 > top of Java-index,Archived Forums,Swing...
# 2
Hi Eduard!I am working on this kind of project and you have to find a model to describe your XML file into objects. I also use JAXP.Believe you have much too do. At first read the tutorial proposed in XML on this site.Hope that it will help you.Mezelin
mezelin2000 at 2007-6-29 2:45:05 > top of Java-index,Archived Forums,Swing...
# 3

You may checkout

http://sourceforge.net/projects/xmlswing/

You will need jdk1.3 or above, (i have tested with jdk1.3).

We have a complete product developed in swing using this utility.

The xml parser we used and tested with are crimson.jar and xerces.jar.

It need js.jar which is a java script engine.

This can be downloaded from

http://www.geocities.com/yadnesh_chonkar/xmlui/crimson.jar

or from http://www.mozilla.org

its basically a javascript engine from mozilla.

The utility needs this file as the utility lets the developer register events in the xml file itself.

The utility is not a code generator, but it interprets the xml in runtime and creates swing components. One can switch between applet and Frame just by changing the attribute value in main.xml, which binds all the screens together.

We have tested this utility on linux as well.

The utility provides various basic components needed to build an application. Incase the component needed is not provided, one can create a class extending the basic XComponent class of the utility and build the component or he/she can simply add that component in the xml file itself.

The best part of the utility is that the user can change the xml and just hit F5 on the screen and the screen will refresh just like the browser.

If you guys need any help please mail yadnesh_99@yahoo.com.

I would love people using this utility as its v. simple and best its free. Please donot think that i am advt. or so, as i am not getting/expecting any revenue from this.

Thanx

Yadnesh

yadnesh_99 at 2007-6-29 2:45:05 > top of Java-index,Archived Forums,Swing...
# 4
check out http://swang.sourceforge.net - thats what u need!
anand_ragavan at 2007-6-29 2:45:05 > top of Java-index,Archived Forums,Swing...
# 5

Swang is(was) exactly what you want. But Swang has been replaced by Axualize. The project changed names but the goal is the same.

Check it out at http://sourceforge.net/projects/axualize/

with axualize you can create a UI like this:

<?xml version="1.0" encoding="UTF-8"?>

<model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://axualize.sourceforge.net" xmlns:s="http://axualize.sourceforge.net/javax/swing/classes" xmlns:a="http://axualize.sourceforge.net/java/awt/classes" xsi:schemaLocation="http://axualize.sourceforge.net ../schema/axualize.xsd http://axualize.sourceforge.net/javax/swing/classes ../schema/javax_swing_classes.xsd http://axualize.sourceforge.net/java/awt/classes ../schema/java_awt_classes.xsd">

<void-alias tag="add" method="add"/>

<process href="../schema/javax_swing_classes.xml"/>

<process href="../schema/java_awt_classes.xml"/>

<s:JFrame>

<string>test</string>

<void method="getContentPane">

<void method="setLayout">

<a:FlowLayout/>

</void>

<add>

<s:JLabel id="l1">

<string>Enter a number</string>

</s:JLabel>

</add>

<add>

<s:JTextField id="t1">

<int>10</int>

<void method="addActionListener">

<Action>

<action-performed>

<try-catch>

<try>

<void class="java.lang.Integer" id="i">

<object idref="t1" property="text"/>

</void>

<echo>

<object idref="i"/>

</echo>

</try>

<catch class="java.lang.Exception" id="e">

<echo>It is not a number!</echo>

<echo>

<object idref="e" method="getMessage"/>

</echo>

</catch>

</try-catch>

</action-performed>

</Action>

</void>

</s:JTextField>

</add>

</void>

<void method="setDefaultCloseOperation">

<object field="EXIT_ON_CLOSE"/>

</void>

<void method="pack"/>

<void method="setVisible">

<true/>

</void>

</s:JFrame>

</model>

WR

Russ White(Author of Swang and now Actualize)

russwyte at 2007-6-29 2:45:05 > top of Java-index,Archived Forums,Swing...