| | |
[urgent] HTML form => XML file
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2005
Posts: 13
Reputation:
Solved Threads: 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
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
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.
![]() |
Similar Threads
- Read XML File in C/C++ (C++)
- HTML display but xml content (HTML and CSS)
- Ignoring xmlns namespaces in the input xml file (XML, XSLT and XPATH)
- extracting ataached xml file from outlook to a folder (IT Professionals' Lounge)
- Displayind data in XML file using HTML (RSS, Web Services and SOAP)
- How to re-organized XML file and call XML file from my software (RSS, Web Services and SOAP)
Other Threads in the JSP Forum
- Previous Thread: load an xml
- Next Thread: java I/O
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish imagetodatabse imageupload internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial video web





