tags:

views:

80

answers:

3

"How can I convert an XHTML form into an XForm that uses an XML file as a data store and is usable in a web browser" Thanks to David Dorward for correcting my question formulation.

+3  A: 

Every valid XHTML file is an XML file :-)

Андрей Костенко
can you please explain more? How can I import xhtml file with a designed form for example into xml? I basically want to design a form in html and export it to xml to be used as xform.
digitup
A: 

XHTML IS XML

well, not exactly. But there is no real difference. XMl is just a set method for describing data in a fairly lose and abstract way that is also nicely controlled. The idea being that XML data is very easy for any XML aware application to read in a work out what is going on.

XHTML is a (roughly speaking) subset of XMl - it is a specific use of XML. It is HTMl written in an XML way.

I know I have said XML and XHTMl a lot here... but its dam hard to explain how these are the same and different at the same time

thecoshman
@thecoshman: I appreciate your help. I would like as mentioned to be able to export the html to xml file where I can upload it to be used as xforms. I wonder how all the html fields will be readable by xforms.
digitup
I'm not aware of any tools that will export HTMl directly to something xforms can read. But if you update you HTMl to make sure it is neatly writen, then xforms should be able to read it. things like changing `<br>` to the proper closed XHTML version `<br />`. properly nest tags do not do this `<p><b></p></b>`. the w3schools site is a great place to get an overview as to why you should use XHTML and how it relates to XML
thecoshman
Thanks again, I can write valid strict HTML document without a problem. May be I should try to design the form code in HTML and see if I can find a tool to export it to xml "xforms". Thanks again
digitup
A: 

Valid XHTML may not be XML due to the mime type it is served with, but valid XHTML is a subset of the XML syntax. That said the perfect solution is to ensure your XHTML is treated as XML by serving it with the mime type application/xhtml+xml instead of text/html.

If that is not a problem you have to supply a XSLT stylesheet to transform your XHTML form into XForms compatible elements, or simply serve XForms type form in your XHTML document directly. I recommend the later of those two solutions.