Hi,
after spending some days, i still got the
saxon:parse and saxon:serialize functions working through XPLs, but i'm still
facing the problem to catch errors, so that the user could be informed on whats
happening.
Just imagine the following case:
I enter the data to my form, and then try to save
it to eXist. Because of the embedded html through FCKeditor and for correct
saving and indexing to eXist i need to tranform the "HTMLContent" to a subtree
with mixed-content and therefore i use the saxon:parse function.
Refering to the thread: "Re: [ops-users] Problems
with eXist-searching and embedded html!" i found the following
solutions:
My parse-XPL is:
-------------------------
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<p:param name="instance"
type="input"/>
<p:param name="data"
type="output"/>
<p:processor name="oxf:xslt">
<p:input name="data"
href="#instance" debug="INSTANCE"/>
<p:input name="config"
debug="CONFIG">
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* |
node()"/>
</xsl:copy>
</xsl:template>
<xsl:template
match="Inhalt|Apparat|AltBez|Provenienz|Besitz|Schreiber|IncipitText|ExplicitText">
<xsl:copy>
<xsl:copy-of
select="saxon:parse(concat('<!DOCTYPE tag [<!ENTITY nbsp
'' ''>]>',concat
('<htmlContent>',.,'</htmlContent>')))"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
</p:input>
<p:output name="data"
ref="data" debug="SERIALIZED"/>
</p:processor>
</p:config>
On normal content it works fine, but if i enter
some Entites like
"uͤ"
It does not work and gives the following error in
the logs:
2007-06-25 17:15:52,815 http-8085-2 ERROR
webapp.ProcessorService - Exception at oxf:/apps/common/parse_SIG.xpl,
line 1, column 56
org.xml.sax.SAXParseException: The character reference must end with the ';' delimiter. My problem now is, that i need this error on my
page and stop proceeding the actions!
When i hit the Save-Trigger, i have xforms:action
defined as:
<xforms:action
ev:event="DOMActivate">
<xforms:send
submission="parse-submission"/>
<xforms:send
submission="save-submission"/>
<xforms:send
submission="serialize-submission"/>
</xforms:action>
So you can see, when parsing fails, the other
submissions are still send, and therefore "wrong" data is saved to the
eXist-DB.
How can i get control of this?
OK, it might be easier if i would have all steps in
just one XPL, right, but i didN#t get that working, because then i need more
than one instance passed to the XPL and i found no way to do that. I would need
some paramters out of 2 instances and of course my document-instance as well
inside my XPL to get the right saving-path! And then there would be still the
question about the submission erros, that are now working just like in the
Gov-Forms example. But only on REST-Submissions and not for XPLs
:-((
Does that make sence to you? Hope that i could make
my point clear and everyone understands my problem!
Every help is appreciated! Thanks,
Marcus
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Hi Marcus,
On 6/25/07, Marcus <[hidden email]> wrote: > On normal content it works fine, but if i enter some Entites like > "uͤ" > It does not work and gives the following error in the logs: > > 2007-06-25 17:15:52,815 http-8085-2 ERROR webapp.ProcessorService - > Exception at oxf:/apps/common/parse_SIG.xpl, line 1, column 56 > org.xml.sax.SAXParseException: The character reference must end with the ';' > delimiter. This is indeed not well-formed XML. You should have: uͤ (note the additional ";"). > My problem now is, that i need this error on my page and stop proceeding the > actions! > When i hit the Save-Trigger, i have xforms:action defined as: > > <xforms:action ev:event="DOMActivate"> > <xforms:send submission="parse-submission"/> > <xforms:send submission="save-submission"/> > <xforms:send submission="serialize-submission"/> > </xforms:action> > > So you can see, when parsing fails, the other submissions are still send, > and therefore "wrong" data is saved to the eXist-DB. > How can i get control of this? when parse-submission receives xforms-submit-done, you run save-submission. And when save-submission receives save-submission you run serialize-submission. Or you can use the "if" attribute and only run the next submission if the previous one returns something that indicates it went fine. > OK, it might be easier if i would have all steps in just one XPL, right, but > i didN#t get that working, because then i need more than one instance passed > to the XPL and i found no way to do that. I would need some paramters out of > 2 instances and of course my document-instance as well inside my XPL to get > the right saving-path! And then there would be still the question about the > submission erros, that are now working just like in the Gov-Forms example. > But only on REST-Submissions and not for XPLs :-(( With XForms submissions you can only pass one instance. If you want to pass multiple XML documents to an XPL file, you can use xxforms:call-xpl(). See: http://www.orbeon.com/ops/doc/reference-xforms-2#ops-extensions I hope this helps, Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Hi Alex,
i have some more questions on your answer :-) > This is indeed not well-formed XML. You should have: uͤ > (note the additional ";"). OK, that would be the problem if one is entering html-tags by hand, and not only with the FCKeditor, which supports indeed XHTML 1.0 > When the trigger is pressed, you could run only parse-submission. Then > when parse-submission receives xforms-submit-done, you run > save-submission. And when save-submission receives save-submission you > run serialize-submission. Or you can use the "if" attribute and only > run the next submission if the previous one returns something that > indicates it went fine. So the xforms-submit-done event is fired every time a submission is correctly fullfilled? I tried to use the additional "event-managing-block" like in the "save-submission" from Gov-Form, and there is a xforms-submit-done action and also some error actions, but nothing happend, when the parsing failed :-(( Can i fire some custom events out of the XPL that i can catch on my submission for further controlls, or waht did you mean with the last sentence? The only thing that is changed might by the instance - do i have further possibilities?? > With XForms submissions you can only pass one instance. If you want to > pass multiple XML documents to an XPL file, you can use > xxforms:call-xpl(). See: > http://www.orbeon.com/ops/doc/reference-xforms-2#ops-extensions Hmm, but in the example the xxforms:call-xpl() is used within a binding expression. Can i use it also within a trigger instead of using <xforms:send submission> something like <xxforms:call-xpl> and how can i manage there which instance should be replaced!? And back to the question if i can fire events out of an XPL. When i do all in one singel XPL, how can i use the custom-error-management there!? So i think i have to stay with the <xforms:send submission> until there is no other way to deal with firing events then test only the "xforms-submit-done" :-( While my form could become very big i don't want to bind another instance with xxforms:call-xpl to my document-instance and hold a fully parsed instance too. BTW you may have more experience with that - for performance issues, would a binding for a second parsed-instance that will be updated with every value-change to be preferd to my solution, when i only parse the document right before saving? I think mine should be the more performant way, shouldn't it? Regards, Marcus -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Marcus,
On 6/26/07, Marcus <[hidden email]> wrote: > So the xforms-submit-done event is fired every time a submission is > correctly fullfilled? That's right. And it goes to the <xforms:submission>. So in most cases you want to have the event handler inside the corresponding <xforms:submission>. > Can i fire some custom events out of the XPL that i can catch on my > submission for further controlls, or waht did you mean with the last > sentence? The only thing that is changed might by the instance - do i have > further possibilities?? No, you can't fire XForms events from XPL. But you can return something different in the instance and then test on that instance with an "if" in XForms. There is more about this on: http://www.orbeon.com/ops/doc/reference-xforms-2#xforms11-if-while > Hmm, but in the example the xxforms:call-xpl() is used within a binding > expression. Can i use it also within a trigger instead of using > <xforms:send submission> > something like > <xxforms:call-xpl> > and how can i manage there which instance should be replaced!? You can do: <xforms:insert context="where you want the insertion to be done" origin="xxforms:call-xpl(...)"/> > BTW you may have more experience with that - for performance > issues, would a binding for a second parsed-instance that will be updated > with every value-change to be preferd to my solution, when i only parse the > document right before saving? I think mine should be the more performant > way, shouldn't it? If the instance isn't large, I don't think it will make a big different either way. Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Hi Alex,
>> So the xforms-submit-done event is fired every time a submission is >> correctly fullfilled? > That's right. And it goes to the <xforms:submission>. So in most cases > you want to have the event handler inside the corresponding > <xforms:submission>. <xforms:action ev:event="xforms-submit-done"> OK, i'll something with that. But as i said, i tried to you the error-handlin out of the gov-forms: <xforms:submission id="parse-submission" ref="xxforms:instance('document-instance')" action="/admin/service/parse/{xxforms:instance('parameters-instance')/form-id}" method="post" replace="instance" f:url-type="resource" xxforms:instance="document-instance" > <xforms:setvalue ev:event="xforms-submit-serialize" ref="instance('persistence-admin-instance')/save-status">validated</xforms:setvalue> <xforms:action ev:event="xforms-submit-done"> <xforms:setvalue ref="instance('persistence-admin-instance')/message" value="xxforms:instance('resources-instance')/forms/detail/messages/save-success"/> <xforms:setvalue ref="xxforms:instance('control-instance')/data-status"/> <xforms:setvalue ref="instance('persistence-admin-instance')/save-status"/> <xforms:toggle case="ok-message"/> </xforms:action> <xforms:action ev:event="xforms-submit-error"> <xforms:action if="not(instance('persistence-admin-instance')/save-status = 'validated')"> <xforms:setvalue ref="instance('persistence-admin-instance')/message" value="xxforms:instance('resources-instance')/forms//detail/messages/save-error-form"/> <xforms:toggle case="validation-error-message"/> </xforms:action> <xforms:action if="instance('persistence-admin-instance')/save-status = 'validated'"> <xforms:setvalue ref="instance('persistence-admin-instance')/message" value="xxforms:instance('resources-instance')/forms//detail/messages/save-error-submission"/> <xforms:toggle case="fatal-error-message"/> </xforms:action> <xforms:setvalue ref="instance('persistence-admin-instance')/save-status"/> </xforms:action> </xforms:submission> But it seems not to work here :-( How can i test, which events are fired when? What about the other xform-events like: <xforms:action ev:event="xforms-submit-serialize"> <xforms:action ev:event="xforms-submit-error"> Do they only appear when saving data through REST or also with every submission? > No, you can't fire XForms events from XPL. But you can return > something different in the instance and then test on that instance > with an "if" in XForms. There is more about this on: > http://www.orbeon.com/ops/doc/reference-xforms-2#xforms11-if-while The problem is, that at the moment i still use only one instance for holding my data, and when i parsed it correctly, it should go directly to the eXist-DB, so saving additional data won't be very good i think. Or did you mean only to add further data in case of an error, so a testing for that addition data would give the information, if something went wrong (if additional data is there) or everything went fine (none additional data) - something like that? Could you help my, how i could then delete a singel node from root-tree after testing, so that my document-instance would become valid against my schema again? >> Hmm, but in the example the xxforms:call-xpl() is used within a binding >> expression. Can i use it also within a trigger instead of using >> <xforms:send submission> >> something like >> <xxforms:call-xpl> >> and how can i manage there which instance should be replaced!? > > You can do: > <xforms:insert context="where you want the insertion to be done" > origin="xxforms:call-xpl(...)"/> >> BTW you may have more experience with that - for performance >> issues, would a binding for a second parsed-instance that will be updated >> with every value-change to be preferd to my solution, when i only parse >> the >> document right before saving? I think mine should be the more performant >> way, shouldn't it? > > If the instance isn't large, I don't think it will make a big > different either way. That is just the point, in my opinion the instance is large, but WHEN is an instance large or not!? My emtpy form-template has 160 lines with nodes, but all empty! There can be added some additional nodes in subtrees by the user, and the data that wioll be inserted are not only single values, but full text parts and additional embedded-html. Regards, Marcus -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Marcus,
I think the best thing so we can help you effectively on this it to take this one problem at a time. Or at least one problem per thread :). Try to create a reproducible test case which is as simple as possible, that we can run in the sandbox, and that shows the problem. On 6/27/07, Marcus <[hidden email]> wrote: > But it seems not to work here :-( How can i test, which events are fired > when? For instance, you can start with this one: why isn't the xforms-submit-done or xforms-submit-error called in your case? Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |