Hello everybody!
I'm pretty new to XForms and doing a project with XForms and eXist, so I have an XML file as a database. The problem I'm having is the following:
My XForms document looks something like this:
[code=xml]
...
<xf:model version="1.0">
<xf:instance id="data-instance" src="data.xml" xmlns="">
<Data>
<FirstName/>
<LastName/>
</Data>
</xf:instance>
<xf:submissio n id="read-from-file" method="get" action="http://localhost:8080/exist/rest/db/eXist_test/data.xml" replace="instan ce" instance="data-instance"/>
<xf:submissio n id="save-to-file" method="put" action="http://localhost:8080/exist/rest/db/eXist_test/data.xml" replace="instan ce" instance="data-instance"/>
</xf:model>
...
<xf:input ref="/Data/FirstName"><xf: label>First Name: </xf:label></xf:input><br/>
<xf:input ref="/Data/LastName"><xf:l abel>Last Name: </xf:label></xf:input><br/>
<xf:submit submission="rea d-from-file"><xf:label >Load</xf:label></xf:submit>
<xf:submit submission="sav e-to-file"><xf:label >Save</xf:label></xf:submit>
...
[/code] and my XML document looks like this:
Now, when the document loads, it loads the values from the XML file into the Document, ditto when I click on "Load" and when I click on "Save" it submits the changes to my XML file. So far so good - but now I want to be able to add new tags to the XML file via the webinterface (e.g. <MiddleName>). When I have further paths in my XForms document, they just won't display, unless they belong to a different instance (which isn't a choice I guess, because it will only submit the data of one instance when I save).
My idea was therefore to cut out the src="data.xml" part in the instance description and just load the entries manually. Also, the read-from-file submission would have to be changed. However, I can't seem to be able to find anything like that online. Any ideas or suggestions, how do do this differently?
Greetings,
Nepomuk
I'm pretty new to XForms and doing a project with XForms and eXist, so I have an XML file as a database. The problem I'm having is the following:
My XForms document looks something like this:
[code=xml]
...
<xf:model version="1.0">
<xf:instance id="data-instance" src="data.xml" xmlns="">
<Data>
<FirstName/>
<LastName/>
</Data>
</xf:instance>
<xf:submissio n id="read-from-file" method="get" action="http://localhost:8080/exist/rest/db/eXist_test/data.xml" replace="instan ce" instance="data-instance"/>
<xf:submissio n id="save-to-file" method="put" action="http://localhost:8080/exist/rest/db/eXist_test/data.xml" replace="instan ce" instance="data-instance"/>
</xf:model>
...
<xf:input ref="/Data/FirstName"><xf: label>First Name: </xf:label></xf:input><br/>
<xf:input ref="/Data/LastName"><xf:l abel>Last Name: </xf:label></xf:input><br/>
<xf:submit submission="rea d-from-file"><xf:label >Load</xf:label></xf:submit>
<xf:submit submission="sav e-to-file"><xf:label >Save</xf:label></xf:submit>
...
[/code] and my XML document looks like this:
Code:
<Data> <FirstName>Peter</FirstName> <LastName>Parker</LastName> </Data>
My idea was therefore to cut out the src="data.xml" part in the instance description and just load the entries manually. Also, the read-from-file submission would have to be changed. However, I can't seem to be able to find anything like that online. Any ideas or suggestions, how do do this differently?
Greetings,
Nepomuk
Comment