Re: [Xsltforms-support] Unsupported mediatype 'text/html' for instance #myinstance
Brought to you by:
alain-couthures
|
From: <bc...@sh...> - 2015-08-01 14:54:33
|
Hello
I think I have sorted this.
Firstly, I had contributed to the problem because I had not added the
xforms xmlns prefix to the resource element in the submission.
Secondly, I have realised (through debug and further reading etc) that the
resource element's 'value' attribute has to be an xpath (or an xpath
function); a plain text string (to a resource) as I had, will not work.
Therefore this works now:
<xf:submission id="mysubmission" method="get" serialization="none"
mode="synchronized" replace="instance" instance="myinstance">
<xf:resource value="concat('/rest/db/data/','myxmldoc.xml')" />
</xf:submission>
But my original:
<xf:submission id="mysubmission" method="get" serialization="none"
mode="synchronized" replace="instance" instance="myinstance">
<xf:resource value="/rest/db/data/myxmldoc.xml" />
</xf:submission>
will not work, as the @value is not an xpath or a function.
That's how I figure it anyway :-)
Thank you
Marked as solved.
On 31 July 2015 at 09:20, <bc...@sh...> wrote:
> Hello, good morning xslt-support@
>
>
> I am struggling to resolve how to do something; I want to use the correct
> method to load a new xml document as a replacement to the existing xml in
> an instance in the XForm model.
>
> For the submission element, if the attribute 'resource' is used then it
> works.
> If a child element '<resource value="...">' is used instead, then it does
> not work and the error message returned is, "Unsupported mediatype
> 'text/html' for instance #myinstance"
>
> Therefore, as it stands the following submission works:
>
> <xf:submission id="mysubmission" method="get" serialization="none"
> mode="synchronized" replace="instance" instance="myinstance"
> resource="/rest/db/data/myxmldoc.xml" />
>
> This submission variation does not (error as described above):
>
> <xf:submission id="mysubmission" method="get" serialization="none"
> mode="synchronized" replace="instance" instance="myinstance">
>
> <resource value="/rest/db/data/myxmldoc.xml" />
> </xf:submission>
>
> I need to use the latter submission (with the resource element) later on,
> as I need to dynamically alter the resource value at submission time.
>
> The backend server is eXist-db. If I call the xml instance via the
> browser directly from the REST server as a test, the headers show that the
> content type is "application/xml", so this content would appear to be fine
> and therefore I cannot work out why there is an unsupported mediatype error.
>
> Please, what is the correct/better way to achieve the above, or is there a
> problem somewhere in XSLTForms that I am creating regarding the
> content-type on the request/return following triggering the submission
> using the resource element?
>
> Thank you for some advice and pointers.
> Regards
> BC Habs
> Hallifax
> UK
>
>
>
>
>
|