Hi, Inside a XPL file, I have problem retrieving member of XML
instance as a SQL search criteria while have been able to successfully xmlize
and serialize the whole XML instance. As you can see in the attached test code, part 1 is to
serialize the whole input to verify whether the XML instance has been produced
and passed in, which has been caught as follows: <?xml version="1.0"
encoding="utf-8"?> <status
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns="http://www.orbeon.com/oxf/controller"> <action>get-app-data</action>
<selected-index>4</selected-index>
<selected-app-id/> </status> But in part 2, the sql processor has problem retrieving
instance member selected-index thru the statement <sql:param
select="/*/selected-index" type="xs:int"/> as the SQL
search crtiera, as indicate in the debugging message shown below: DEBUG sql.SQLProcessor - Executing query/call for statement:
select Application_Data
from Applications
where Orbeon_ID = ? Any clue will be highly appreciated. Regards, Spenser <!—Two parts of test code: xml-serializer + file-serializer
and sql processor --> <p:config
xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xu="http://www.xmldb.org/xupdate"
xmlns:oxf="http://www.orbeon.com/oxf/processors"> <p:param type="input"
name="instance"/> <p:param type="output"
name="data"/> <!— part 1: xml-serializer + file-serializer –
just for verification à <p:processor name="oxf:xml-serializer"> <p:input
name="data" href="#instance"/> <p:input
name="config"> <config> <encoding>utf-8</encoding> </config> </p:input>
<p:output
name="data" id="converted_xml"/> </p:processor> <p:processor name="oxf:file-serializer"> <p:input name="data"
href="#converted_xml"/> <p:input
name="config"> <config> <file>whole-input_test.xml</file> <directory>c:/temp</directory> <encoding>utf-8</encoding> </config> </p:input> </p:processor> <!— part 2: sql processor à <p:processor
name="oxf:sql"> <!--
p:input name="data" href="#converted_xml"/ --> <p:input
name="data" href="#instance" debug="true"/> <p:input
name="datasource" href="datasource.xml"/> <p:input
name="config" debug="true">
<sql:config>
<sql:connection>
<sql:execute>
<sql:query>
select
Application_Data
from
Applications
where
Orbeon_ID = <sql:param select="/*/selected-index"
type="xs:int"/>
</sql:query> <!-- sql-type="xmltype"
-->
<sql:results>
<sql:row-results>
<Application_Data><sql:get-column
type="xs:string"
column="Application_Data"/></Application_Data>
</sql:row-results>
</sql:results>
</sql:execute>
</sql:connection>
</sql:config> </p:input> <p:output
name="data" ref="data"/> </p:processor> <p:config> -- 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
|
Spenser,
Namespace issue. Your selected-index is in the "controller" namespace (xmlns="http://www.orbeon.com/oxf/controller"). This means that you can't access it simply with: /*/selected-index But you have to declare something like this in the SQL processor config: <xsl:config xmlns:c="http://www.orbeon.com/oxf/controller" ...> and then: /*/c:selected-index Alternatively, you can make it so your <status> element is not in the controller namespace (and in fact I wonder why it is). -Erik Spenser Kao wrote: > Hi, > > > > Inside a XPL file, I have problem retrieving member of XML instance as a > SQL search criteria while have been able to successfully xmlize and > serialize the whole XML instance. > > > > As you can see in the attached test code, part 1 is to serialize the > whole input to verify whether the XML instance has been produced and > passed in, which has been caught as follows: > > <?xml version="1.0" encoding="utf-8"?> > > <status xmlns:oxf="http://www.orbeon.com/oxf/processors" > > xmlns="http://www.orbeon.com/oxf/controller"> > > <action>get-app-data</action> > > <selected-index>4</selected-index> > > <selected-app-id/> > > </status> > > > > But in part 2, the sql processor has problem retrieving instance member > selected-index thru the statement <sql:param select="/*/selected-index" > type="xs:int"/> as the SQL search crtiera, as indicate in the debugging > message shown below: > > DEBUG sql.SQLProcessor - Executing query/call for statement: > > select Application_Data > > from Applications > > where Orbeon_ID = ? > > > > Any clue will be highly appreciated. > > > > Regards, > > > > Spenser > > > > <!—Two parts of test code: xml-serializer + file-serializer and sql > processor --> > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > > xmlns:sql="http://orbeon.org/oxf/xml/sql" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:xs="http://www.w3.org/2001/XMLSchema" > > xmlns:xu="http://www.xmldb.org/xupdate" > > > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > > > > <p:param type="input" name="instance"/> > > <p:param type="output" name="data"/> > > > > <!— part 1: xml-serializer + file-serializer – just for verification à > > <p:processor name="oxf:xml-serializer"> > > <p:input name="data" href="#instance"/> > > <p:input name="config"> > > <config> > > <encoding>utf-8</encoding> > > </config> > > </p:input> > > <p:output name="data" id="converted_xml"/> > > </p:processor> > > > > <p:processor name="oxf:file-serializer"> > > <p:input name="data" href="#converted_xml"/> > > <p:input name="config"> > > <config> > > <file>whole-input_test.xml</file> > > <directory>c:/temp</directory> > > <encoding>utf-8</encoding> > > </config> > > </p:input> > > </p:processor> > > > > <!— part 2: sql processor à > > <p:processor name="oxf:sql"> > > <!-- p:input name="data" href="#converted_xml"/ --> > > <p:input name="data" href="#instance" debug="true"/> > > <p:input name="datasource" href="datasource.xml"/> > > <p:input name="config" debug="true"> > > <sql:config> > > <sql:connection> > > <sql:execute> > > <sql:query> > > select Application_Data > > from Applications > > where Orbeon_ID = <sql:param > select="/*/selected-index" type="xs:int"/> > > </sql:query> <!-- sql-type="xmltype" > --> > > <sql:results> > > <sql:row-results> > > <Application_Data><sql:get-column > type="xs:string" column="Application_Data"/></Application_Data> > > </sql:row-results> > > > </sql:results> > > > </sql:execute> > > </sql:connection> > > </sql:config> > > </p:input> > > <p:output name="data" ref="data"/> > > </p:processor> > > <p:config> Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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 Erik,
Hi Erik, Thanks for the hints, my Proof of Concept demo pages are working now - finally. But in passing XML instance ahead the navigation toward the next page, I found that xslt way doesn't work as recommended by OPS tutorial, while deprecated XUpdate works. Is that a norm? If I chose the xslt way, error "xforms:instance element must contain exactly one child element" would generate - that's because selected-app-id value couldn't be picked up, resulting to an empty resultset. First attached below is the snippet of page-flow.xml that passes XML instance successfully, followed by the SQL Processor code that picks the XML instance. <page id="query-app-ids" path-info="/lts-poc/query-app-ids" model="query-app-ids.xpl" view="query-app-ids.xhtml"> <action when="/status/action = 'get-app-data'"> <!-- the xupdate way is a working one! --> <result page="query-app-data"> <xu:update select="/status" xmlns:xu="http://www.xmldb.org/xupdate"> <xu:copy-of select="document('input:instance')/status/*"/> </xu:update> </result> <!-- By contrast, xslt way isn't working as recommended by ops tutorial --> <!-- <result page="query-app-data" transform="oxf:xslt"> <status xsl:version="2.0"> <selected-index> <xsl:value-of select="document('input:instance')/status/selected-index"/> </selected-index> <selected-app-id> <xsl:value-of select="document('input:instance')/status/selected-app-id"/> </selected-app-id> </status> </result> --> </action> <action when="/status/action = 'bye'"> <result page="bye"/> </action> </page> <p:processor name="oxf:sql"> <p:input name="data" href="#instance" debug="true"/> <p:input name="datasource" href="datasource.xml"/> <p:input name="config" debug="true"> <sql:config> <sql:connection> <sql:execute> <sql:query> select Application_Data from Applications where Application_ID = <sql:param select="//selected-app-id" type="xs:string"/> </sql:query> <sql:results> <sql:row-results> <Application_Data><sql:get-column type="xs:string" column="Application_Data"/></Application_Data> </sql:row-results> </sql:results> </sql:execute> </sql:connection> </sql:config> </p:input> <p:output name="data" ref="data"/> </p:processor> Regards, Spenser -----Original Message----- From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez Sent: Wednesday, 27 September 2006 3:59 AM To: [hidden email] Subject: Re: [ops-users] Problem of Picking XML Instance Member in XPL as SQL Search Crtieria Spenser, Namespace issue. Your selected-index is in the "controller" namespace (xmlns="http://www.orbeon.com/oxf/controller"). This means that you can't access it simply with: /*/selected-index But you have to declare something like this in the SQL processor config: <xsl:config xmlns:c="http://www.orbeon.com/oxf/controller" ...> and then: /*/c:selected-index Alternatively, you can make it so your <status> element is not in the controller namespace (and in fact I wonder why it is). -Erik Spenser Kao wrote: > Hi, > > > > Inside a XPL file, I have problem retrieving member of XML instance as a > SQL search criteria while have been able to successfully xmlize and > serialize the whole XML instance. > > > > As you can see in the attached test code, part 1 is to serialize the > whole input to verify whether the XML instance has been produced and > passed in, which has been caught as follows: > > <?xml version="1.0" encoding="utf-8"?> > > <status xmlns:oxf="http://www.orbeon.com/oxf/processors" > > xmlns="http://www.orbeon.com/oxf/controller"> > > <action>get-app-data</action> > > <selected-index>4</selected-index> > > <selected-app-id/> > > </status> > > > > But in part 2, the sql processor has problem retrieving instance member > selected-index thru the statement <sql:param select="/*/selected-index" > type="xs:int"/> as the SQL search crtiera, as indicate in the debugging > message shown below: > > DEBUG sql.SQLProcessor - Executing query/call for statement: > > select Application_Data > > from Applications > > where Orbeon_ID = ? > > > > Any clue will be highly appreciated. > > > > Regards, > > > > Spenser > > > > <!Two parts of test code: xml-serializer + file-serializer and sql > processor --> > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > > xmlns:sql="http://orbeon.org/oxf/xml/sql" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:xs="http://www.w3.org/2001/XMLSchema" > > xmlns:xu="http://www.xmldb.org/xupdate" > > > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > > > > <p:param type="input" name="instance"/> > > <p:param type="output" name="data"/> > > > > <! part 1: xml-serializer + file-serializer just for verification à > > <p:processor name="oxf:xml-serializer"> > > <p:input name="data" href="#instance"/> > > <p:input name="config"> > > <config> > > <encoding>utf-8</encoding> > > </config> > > </p:input> > > <p:output name="data" id="converted_xml"/> > > </p:processor> > > > > <p:processor name="oxf:file-serializer"> > > <p:input name="data" href="#converted_xml"/> > > <p:input name="config"> > > <config> > > <file>whole-input_test.xml</file> > > <directory>c:/temp</directory> > > <encoding>utf-8</encoding> > > </config> > > </p:input> > > </p:processor> > > > > <! part 2: sql processor à > > <p:processor name="oxf:sql"> > > <!-- p:input name="data" href="#converted_xml"/ --> > > <p:input name="data" href="#instance" debug="true"/> > > <p:input name="datasource" href="datasource.xml"/> > > <p:input name="config" debug="true"> > > <sql:config> > > <sql:connection> > > <sql:execute> > > <sql:query> > > select Application_Data > > from Applications > > where Orbeon_ID = <sql:param > select="/*/selected-index" type="xs:int"/> > > </sql:query> <!-- sql-type="xmltype" > --> > > <sql:results> > > <sql:row-results> > > <Application_Data><sql:get-column > type="xs:string" column="Application_Data"/></Application_Data> > > </sql:row-results> > > > </sql:results> > > > </sql:execute> > > </sql:connection> > > </sql:config> > > </p:input> > > <p:output name="data" ref="data"/> > > </p:processor> > > <p:config> Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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
|
Spenser,
> But in passing XML instance ahead the navigation toward the next > page, I found that xslt way doesn't work as recommended by OPS > tutorial, while deprecated XUpdate works. Is that a norm? XSLT should work ;-) > If I chose the xslt way, error "xforms:instance element must contain exactly > one child element" would generate - that's because selected-app-id value > couldn't be picked up, resulting to an empty resultset. > > First attached below is the snippet of page-flow.xml that passes XML > instance successfully, followed by the SQL Processor code that picks the XML > instance. Try: <status xsl:version="2.0" xmlns=""> ... -Erik -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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 Erik,
Yes, the addition of xmlns="" has really done the trick! Thanks for the insight. Regards, Spenser -----Original Message----- From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez Sent: Friday, 29 September 2006 7:34 AM To: [hidden email] Subject: Re: [ops-users] Problem of Picking XML Instance Member in XPL as SQL Search Crtieria Spenser, > But in passing XML instance ahead the navigation toward the next > page, I found that xslt way doesn't work as recommended by OPS > tutorial, while deprecated XUpdate works. Is that a norm? XSLT should work ;-) > If I chose the xslt way, error "xforms:instance element must contain exactly > one child element" would generate - that's because selected-app-id value > couldn't be picked up, resulting to an empty resultset. > > First attached below is the snippet of page-flow.xml that passes XML > instance successfully, followed by the SQL Processor code that picks the XML > instance. Try: <status xsl:version="2.0" xmlns=""> ... -Erik -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- 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 |