tags:

views:

88

answers:

2

Hi guys,

I wanted to see some of your ideas/opinions/suggestions on the following problem. The idea is to have a simple webapp (java webapp) collecting user's input that essentially is turned into an XML file? The final XML file has to be valid and has to conform to a DTD.

What would be a good way to dynamically collect an input presenting users with all the possible choices at a given step? For example, if we are at the point of a |start| tag and now a user can create tag |head| or |body| or |bla| what's a good way of presenting and validating this info?

I look forward to seeing some of your interesting ideas. Thanks.

+1  A: 

If you create an object model that represents what is available, and an editor that is tied to that model, you can rather easily serialize that into XML.

Searching for "Java XML Serialization" yields some good relevant results, such as this.

Hope that helps!

joeslice
+1  A: 

That's what JAXB supports.

You define a schema and use JAXB to create Java classes that implement that schema. You can then marshall and unmarshall data from Java objects into/from XML documents.

S.Lott
Thanks S.Lott for your comment. I sort of had a similar idea and I wanted to see if may be people had used some other techniques to implement this. May be something even simpler/more trivial that serialization. something that I wasn't aware of. But, I think for what I am trying to do this is a solid choice.
JAXB is a great choice for this functionality.
joeslice
as an alternative, spring has a solution toohttp://static.springsource.org/spring-ws/sites/1.5/reference/html/oxm.html