0

Hi, I've an HTML form (I generated it from a XML schema .xsd file)
I'd like to know a good way to save the form input data (POST/GET don't matter) to an XML file (or fragment) that can be validated with the XML schema that I used to generate the form.


I think that a solution can be this one:

1) with my XSLT I generate the HTML form from the given xml schema

2) with another XSLT I generate a xml file that is a "template" for my html form

3) when the user submit the data with my html form I read the "template" (step 2 and search for the "name" and the respective "value" to give values to my DOM tree (created by that "template")

4) now I must validate it (this fragment) using that XML schema (suggestions? Now I'm able to validate a FILE, not a fragment in memory)

5) if it's valid, I must append to another xml file, that is a kind of simple database, like:
<database>
<record id="1">
....my fields....
</record>
.....
</database>
I think that I must load the "database" XML file and append the fragment with the proper DOM function (I'm right?)


I'm using: Xerces, Xalan, Tomcat (all the latest versions)


Thank you in Advance

Dakkar

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by mavines
0

My answer - use JAXB [https://jaxb.dev.java.net/] parser. It is able to validate almost any XML from any source. Just learn some tricks and you will solve any XML related task. But the only disadvantage here - JAXB is fully supported in Java 6 only.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.