[MAYBE FIXED] Cannot Add Extra Errors
======================================
* http://130.87.106.59:8080/rezdb/db/hfagc/cdf/cdfyasmine/cdf_fall2012_Bs2DsDs.xml
* cannot add extra errors issue, http://cms01.phys.ntu.edu.tw/rezdb/db/hfagc/cdf/cdfyasmine/cdf_fall2012_Bs2DsDs.xml
Reproduce in test environment
------------------------------
Login as guest to /db/test
#. http://130.87.106.59:8080/rezdb/db/test/
#. replace default template `/db/stylesheets/rez-instance-template.xml` with `/db/hfagc/cdf/cdfyasmine/cdf_fall2012_Bs2DsDs.xml`
#. change default resource name from something.xml to cdf_fall2012_Bs2DsDs.xml
#. hit create
#. edit the newly created test resource
#. the Xerrors/Xerr "Append" button does nothing
Understanding why
-------------------
Examine the XML
~~~~~~~~~~~~~~~~~~
Raw xml shows a closed tags for http://130.87.106.59:8080/xmldb/db/test/cdf_fall2012_Bs2DsDs.xml::
In contrast the http://130.87.106.59:8080/xmldb/db/stylesheets/rez-instance-template.xml has a placeholder::
model
absolute
0.2
Create new resource
~~~~~~~~~~~~~~~~~~~~~
#. Create `test_xerror_adding.xml` using the default template
#. the 3rd error:model shows up
#. delete the Xerror and submit, gets you to::
#. thus only get a chance to set the Xerror at creation, and if you delete there is no way to get it back
#. try deleting the syst::
stat
absolute
1.3
1.4
#. and then the stat::
#. same issue : cannot append once down to zero
#. try with mode specification, deleting the Prod down to zero::
-511
BR
on
BR:-511:
#. in contrast this works, can create a prod out of nothing::
-511
111
BR
on
BR:-511:111
#. a prod is very simple though, just an element with a code
Source check
~~~~~~~~~~~~
Check how the xforms are customized
* h/chiba/xsd2xhtml/build.xml
::
290
291
292
::
b2mc:xslxsd heprez$ vi fix-form-3.xsl
b2mc:xslxsd heprez$ pwd
/Users/heprez/h/chiba/xsd2xhtml/src/xslxsd
::
410
::
464
471
472
514
515
516
521
522
558
Thoughts
~~~~~~~~~~~
The real fix requires more knowledge of chiba xforms (an obsolete project) that I care to acquire,
but some kind of workaround stylesheet that can be applied to a quote from the rezdb interface to add back
empties seems that it might be easily tractable.
Maybe apply a stylesheet transform at creation from template that fills in empties.
rezdb create button
~~~~~~~~~~~~~~~~~~~~
The rezdb interface is implemented in xquery and xtylesheets, the heart is the xquery.
* `h/hfag/mods/webapp/hfagc/bookinfo-insert-sm.xq`
Submission from the chiba xforms POSTS to the rezdb instance page::
chiba access to instances of individual quotes or headers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From `hfag/mods/webapp/hfagc/sitemap.xmap.template`::
703
704
705
706
707
708
709
710
711
712
713
714
715
Use **cocoon-view=sauce** to see the generator output::
b2mc:h heprez$ curl -s "http://localhost:9090/hfagc/provide-instance.xq?elem=quote&start=1&doc=/db/test/test_xerror_adding.xml&cocoon-view=sauce" | xmllint --format -
-511
111
BR
on
BR:-511:111
active
-
5.3
0.00001
-
BR:-511:111
b2mc:h heprez$
where the spares come from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`hfag/mods/webapp/hfagc/provide-instance.xq` gives single quotes or header based on request, with the spare src and prod added (for chiba benefit)::
b2mc:h heprez$ curl -s "http://localhost:9090/hfagc/provide-instance.xq?elem=quote&start=1&doc=/db/test/test_xerror_adding.xml" | xmllint --format -
active
-
5.3
0.00001
-
BR:-511:111
-511
111
BR
on
BR:-511:111
-511
111
BR
on
BR:-511:111
Try document with a third error::
curl -s "http://localhost:9090/hfagc/provide-instance.xq?elem=quote&start=1&doc=/db/test/bchdspi0.xml" | xmllint --format -
The last err or xerr is duplicated by the stylesheet::
b2mc:h heprez$ curl -s "http://localhost:9090/hfagc/provide-instance.xq?elem=quote&start=1&doc=/db/test/bchdspi0.xml" | xmllint --format -
active
-
$\bar{B}^- \rightarrow D_s^- \pi^0$
1.5
0.00001
4.9
-
stat
absolute
0.5
0.4
syst
absolute
0.1
syst
absolute
0.1
Ds BR
absolute
0.2
Ds BR
absolute
0.2
BR:-521:-431,111
-521
-431
111
BR
on
BR:-521:-431,111
-521
-431
111
BR
on
BR:-521:-431,111
Due to the xforms fixing the spares do not appear in the interface, but they are there ready to be used for appending
from empty.
When catching POST data with `hfag/mods/webapp/hfagc/bookinfo-insert-sm.xq` the
spares in the last slot are removed::
157 if ( $action = "Update" ) then
158 (: catch the edited data for the quote, parse it as xml, transform it, and store it temporarily :)
159 let $pdata := util:catch( "java.lang.Exception",request:get-request-data(), "" )
160 let $tmpdoc := concat( "/db/chiba/",$user,$doc , "_" , $elem, "_", $start )
161
162 (:
163 add-ns-remove-spare.xsl has spare removal for the last "quote" "src" "prod" "err" and "xerr"
164 which is applied to the parsed POST data prior to saving into /db/chiba
165 eg http://130.87.106.59:8080/xmldb/db/chiba/guest/db/test/test_xerror_adding.xml_quote_1
166 :)
167 let $chiba := util:catch( "java.lang.Exception" ,
168 ixml:parsetransform( $pdata , $tmpdoc , $user , $pass , "xmldb:exist:///db/stylesheets/add-ns-remove-spare.xsl" ,
169
170
171
172
173
174 ),
175 concat( "exception in ixml:parsetransform", $util:exception-message)
176 )
With http://130.87.106.59:8080/xmldb/db/stylesheets/add-ns-remove-spare.xsl
::
b2mc:h heprez$ find . -name add-ns-remove-spare.xsl
./chiba/integration/add-ns-remove-spare.xsl
Possible Solution
~~~~~~~~~~~~~~~~~
Detect and recover instances with empty error or xerror by planting spares
::
b2mc:h heprez$ find . -name no-ns-one-spare-no-exre.xsl
./chiba/xsd2xhtml/src/xslxml/no-ns-one-spare-no-exre.xsl
Grab a quote with the empty issue and a normal::
b2mc:h heprez$ curl -s "http://localhost:9090/hfagc/provide-instance.xq?elem=quote&start=1&doc=/db/test/test_xerror_adding.xml&cocoon-view=sauce" | xmllint --format - > /tmp/k/provide-instance-xq-demo.xml
b2mc:h heprez$ curl -s "http://localhost:9090/hfagc/provide-instance.xq?elem=quote&start=1&doc=/db/test/bchdspi0.xml&cocoon-view=sauce" | xmllint --format - > /tmp/k/provide-instance-xq-demo-normal.xml
Test transform::
xsltproc ~/h/chiba/xsd2xhtml/src/xslxml/no-ns-one-spare-no-exre-no-empties.xsl /tmp/k/provide-instance-xq-demo.xml
Where do these stylesheets get uploaded to xmldb ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The contents of /db/stylesheets contains all the xsl from
* http://130.87.106.59:8080/xmldb/db/stylesheets/
* *chiba-stylesheets*
need to protect chiba from the namespaces
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Avoid putting bare elements in the stylesheet to keep ns-less.
update exist/chiba on cms01
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
[blyth@cms01 ~]$ exist-
[blyth@cms01 ~]$ exist-propagate- webapp/hfagc
[blyth@cms01 ~]$ exist-place-xsl
=== exist-place-xsl : xmllint --xinclude present-instance.xsl --output /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc/stylesheets/present-instance.xsl
=== exist-place-xsl : xmllint --xinclude db2html-scb.xsl --output /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc/stylesheets/db2html-scb.xsl
[blyth@cms01 ~]$ chiba-
[blyth@cms01 ~]$ chiba-stylesheets
[blyth@cms01 ~]$ exist-fill-templates
=== exist-fill-templates : a e /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/docs/security.xml from /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/docs/security.xml.template
NOT updated
=== exist-fill-templates : a e /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc.9dec2011/sitemap.xmap from /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc.9dec2011/sitemap.xmap.template
UPDATED
=== exist-fill-templates : a e /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc.9dec2011/xquery/env.xqm from /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc.9dec2011/xquery/env.xqm.template
UPDATED
=== exist-fill-templates : a e /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc/sitemap.xmap from /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc/sitemap.xmap.template
UPDATED
=== exist-fill-templates : a e /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc/xquery/env.xqm from /data/heprez/install/exist/eXist-snapshot-20051026/unpack/4/webapp/hfagc/xquery/env.xqm.template
UPDATED
[blyth@cms01 ~]$
Test with http://cms01.phys.ntu.edu.tw/rezdb/db/test/b0colsup.xml before bouncing the problem is there
::
curl -s "http://localhost:9090/hfagc/provide-instance.xq?elem=quote&start=1&doc=/db/test/b0colsup.xml&cocoon-view=sauce" | xmllint --format -
Failed to load the stylesheet::
[blyth@cms01 exist_]$ ./putt.py /db/stylesheets/no-ns-one-spare-no-exre-no-empties.xsl /home/blyth/heprez/chiba/xsd2xhtml/src/xslxml --host localhost --port 9090
empty result
fsmt 2013-07-16 11:56:18
dbmt 1970-01-01 08:00:00
empty result
error in putt ... not stamp change 1970-01-01 08:00:00
[blyth@cms01 exist_]$
This was due to a permission denied from out of date password.