[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [no subject]
Thanks! Regards, Alex Yiu ------_=_NextPart_001_01C475C5.A89411E6 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <TITLE></TITLE> <META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR></HEAD> <BODY text=3D#000000 bgColor=3D#ffffff> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>Hello,</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>(this=20 mail is about assign's native data handling in the for-each case and = about $var=20 syntax as a possible helper)</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>The=20 discussion on this issues is a bit calmed down, however I run across one = major=20 point, and want to share my findings (especially with those of you = thinking=20 about using JXPath for assign queries):</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>To=20 actually dynamically create the result of a parallel/sequential = for-each, one=20 could use the XPath createPathAndSetValue() method with an predicate = for a=20 new Element:</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>Sample=20 instance of a message variable:</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2><root></FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2> =20 <level1><level2>AA</level2></level1></FONT></SPAN= ></DIV> <DIV><SPAN class=3D248405622-29072004> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2> =20 <level1><level2>BB</level2></level1></FONT></SPAN= ></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></root></FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2><assign></FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2> =20 <from>bb</from></FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2> =20 <to variable=3D"msgVar" part=3D"root" = query=3D""/root/level1[2]/level2"=20 /></FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></assign></FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>Can be=20 implemented with the follwoing JXpath method:</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>ctx.setValue("/root/level1[2]/level2", = "bb")</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>The=20 assign could also be used to actually create a new = element:</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>ctx.createPathAndSetValue("/root/level1[3]/level2",=20 "CC")</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>However, this legal XPath construct has a few requirements for = the=20 predicate (the [3] on the axis):</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>a)=20 must be a number (a function returning a string does not=20 work)</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>b) the=20 expression must be a context indeendend location = path</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>The=20 given sample works, however, if we want to use a BPEL = counter/instance-number,=20 this will look like:</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>/root/level1[bpws:getVariableData("counter",=20 "count")]/level2</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>This=20 does not work with current JXPath implementations, since extension = functions are=20 not context independend (I guess this can be changed) AND it requires = the=20 function to return a numbr instance.</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>I=20 wonder if the BPEL spec should therefore require engines = to</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>-=20 provide a jxpath parser which allows getVariableData() in create=20 path</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>-=20 provide a xpath extension function which is type = aware</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>BTW:=20 using the $counter variable will solve the issue for JXPath, it asumes = variables=20 to be context independend:</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>/root/level1[$counter]/level2</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2>If you=20 are curious, here is the result of a small JXPath test (using my own=20 DOMAbstractFactory and some sample extension = functions):</FONT></SPAN></DIV> <DIV><SPAN class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff = size=3D2></FONT></SPAN> </DIV> <DIV><SPAN class=3D248405622-29072004> <P><FONT face=3DArial color=3D#0000ff=20 size=3D2>dom.getVal(/root/level1/level2)=3DAA<BR>dom.getVal(/root/level1[= 2]/level2)=3DBB<BR>dom.getVal(/root/level1[last()]/level2)=3DBB<BR>dom.ge= tVal(count(/root/level1))=3D2.0<BR>dom.getVal(/root/level1[count(/root/le= vel1)]/level2)=3DBB<BR>dom.getVal(/root/level1[count(/root/level1)-1]/lev= el2)=3DAA<BR>dom.getVal(concat('hallo',count(/root/level1)))=3Dhallo2<BR>= dom.getVal('/root/level1/level2')=3D/root/level1/level2<BR>dom.getVal(eck= i:str1()+ecki:str2())=3D3.0<BR>dom.getVal(concat(ecki:str1(),ecki:str2())= )=3D12</FONT></P> <P><FONT><FONT face=3DArial><FONT color=3D#0000ff><FONT size=3D2><SPAN=20 class=3D248405622-29072004>OK, enough basic XPath syntax, now the real=20 fun:<BR></SPAN></FONT></FONT></FONT></FONT><FONT><FONT = face=3DArial><FONT=20 color=3D#0000ff><FONT=20 size=3D2>dom.getVal(/root/level1[ecki:str1()]/level2)=3DAA<BR>dom.getVal(= /root/level1[ecki:str2()]/level2)=3DAA</FONT></FONT></FONT></FONT><FONT=20 color=3D#0000ff><SPAN class=3D248405622-29072004><FONT face=3DArial=20 size=3D2> &nbs= p; =20 <- return type is string!<BR></FONT></SPAN><FONT face=3DArial=20 size=3D2>dom.getVal(/root/level1[number(ecki:str2())]/level2)=3DBB</FONT>= </FONT><FONT=20 color=3D#0000ff><SPAN class=3D248405622-29072004><FONT face=3DArial=20 size=3D2> <- casted to right = type<BR></FONT></SPAN><FONT=20 size=3D2><FONT = face=3DArial>dom.getVal(/root/level1[ecki:int2()]/level2)=3DBB<SPAN=20 class=3D248405622-29072004> &nbs= p; <-=20 now correct return type</SPAN></FONT></FONT></FONT></P> <P><FONT face=3DArial color=3D#0000ff size=3D2><SPAN = class=3D248405622-29072004>Now we=20 try to modify an existing node:<BR></SPAN></FONT><FONT face=3DArial = color=3D#0000ff=20 size=3D2>ctx.createPathAndSetValue(/root/level1/level2, XX) = done.<BR></FONT><FONT=20 face=3DArial color=3D#0000ff = size=3D2>dom.getVal(/root/level1[1]/level2)=3DXX<SPAN=20 class=3D248405622-29072004> &nbs= p;  = ; =20 <- yes it worked</SPAN><BR></FONT><FONT face=3DArial><FONT = color=3D#0000ff=20 size=3D2>dom.getVal(/root/level1[2]/level2)=3DBB<SPAN=20 class=3D248405622-29072004> &nbs= p;  = ; =20 <- affected only the first node</SPAN><BR></FONT></FONT></P> <P><FONT><FONT><SPAN class=3D248405622-29072004><FONT face=3DArial = color=3D#0000ff=20 size=3D2>Now we want to create a new one (first check to see that = there is=20 no 3rd level1 element:)<BR></FONT></SPAN></FONT></FONT><FONT><FONT = face=3DArial=20 color=3D#0000ff=20 size=3D2>dom.getVal(/root/level1[3]/level2)=3Dorg.apache.commons.jxpath.J= XPathException:=20 No value for xpath: /root/level1[3]/level2<BR></FONT></FONT><FONT=20 face=3DArial><FONT color=3D#0000ff><FONT=20 size=3D2>ctx.createPathAndSetValue(/root/level1[3]/level2, YY)=20 done.<BR>dom.getVal(/root/level1[3]/level2)=3DYY<SPAN=20 class=3D248405622-29072004> &nbs= p;  = ; = =20 <- now a third node exists</SPAN></FONT></FONT></FONT></P> <P><SPAN class=3D248405622-29072004><FONT face=3DArial size=3D2>Now we = try the same=20 with a number expression;<BR></FONT></SPAN><FONT color=3D#0000ff><FONT = face=3DArial=20 size=3D2>ctx.createPathAndSetValue(/root/level1[ecki:int2()+ecki:int2()]/= level2,=20 ZZ) failed: org.apache.commons.jxpath.JXPathException</FONT><SPAN=20 class=3D248405622-29072004><FONT face=3DArial=20 size=3D2>: <BR> =20 </FONT></SPAN></FONT><FONT face=3DArial color=3D#0000ff = size=3D2>Exception trying to=20 create xpath /root/level1[ecki:int2()+ecki:int2()]/level2;<BR><SPAN=20 class=3D248405622-29072004> =20 </SPAN>JXPath can only create a path if it uses exclusively the child:: = and=20 attribute:: axes and has no context-dependent = predicates<BR></FONT></SPAN><SPAN=20 class=3D248405622-29072004><FONT face=3DArial color=3D#0000ff=20 size=3D2></FONT></SPAN></P></DIV> <DIV></SPAN></SPAN><FONT face=3DArial size=3D2>Mit freundlichen = Gr=FC=DFen<BR>Bernd=20 Eckenfels<BR></FONT><FONT face=3DArial size=3D1>Chief = Architect<BR>--<BR>SEEBURGER=20 AG - Edisonstr.1 , D-75015 Bretten, Germany<BR>Fax: +49 (0)7252 96-2400 = - Phone:=20 +49 (0)7252 96-1256<BR><A=20 href=3D"mailto:b.eckenfels@seeburger.de">mailto:b.eckenfels@seeburger.de<= /A> - <A=20 href=3D"http://www.seeburger.de/" = target=3D_blank>http://www.seeburger.de</A></FONT>=20 </DIV></DIV></DIV> <BLOCKQUOTE> <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT = face=3DTahoma=20 size=3D2>-----Original Message-----<BR><B>From:</B> Alex Yiu=20 [mailto:alex.yiu@oracle.com]<BR><B>Sent:</B> Tuesday, May 11, 2004 = 7:33=20 PM<BR><B>To:</B> ygoland@bea.com<BR><B>Cc:</B> Ron Ten-Hove; Danny van = der=20 Rijn; wsbpeltc; Alex Yiu<BR><B>Subject:</B> Re: [wsbpel] Issue 103 - = draft=20 proposal<BR><BR></FONT></DIV><BR>Yaron, <BR><BR>Thank you for reading = the=20 proposal in details. <BR>I totally agree with you that it will still = take a=20 number of emails to get all details of this proposal flushed out = right. :-)=20 <BR><BR>Summary: <BR>---------------------------------<BR>Regarding to = QNAME=20 collision, that issue has been at the back of my mind for a while. I = have been=20 putting it in a lower priority in my thinking process. I also want to = solve=20 the collision issue. <BR><BR>I agree with mostly with your point = "<I>1) Enable=20 BPEL variables to be defined using both simpleTypes and complexTypes = (I have=20 been meaning to propose this anyway).</I> <I>Then require that XML = schemas=20 auto-generated from WSDL messages be anonymous ...</I>" <BR><BR>For = your point=20 "<I>2) Introduce the bpel:partName attribute ...</I>" ... I am not = sure that=20 is necessary.<BR>---------------------------------<BR><BR><BR>Detailed = reply=20 to your feedback (which is very constructive):<BR><BR>(I)<BR>"<I>1) = Enable=20 BPEL variables to be defined using both simpleTypes and = <BR>complexTypes (I=20 have been meaning to propose this anyway).</I>" <BR><BR>If my analysis = (below)=20 is right, we can solve the QNAME collision problem without formal = introducing=20 ComplexType into variable declaration. We may no need to introduce = complexType=20 to solve this issue. Let's handle complexType issue separately. (I am = still=20 open to that idea in general.)<BR><BR>(II)<BR>Also under "1)", = "<I>Then=20 require that XML schemas auto-generated from WSDL messages be = anonymous=20 ...</I>"<BR><BR>I think I like this idea. We can avoid QNAME collision = by=20 generating anonymous QNAME for XML Schema Element corresponding to a = WSDL=20 Message Type. <BR><BR>Given that adopting this mechanism, I would = remove item=20 (4) in my proposal ("messageType" =3D> "messageElement"). Keeping = messageType=20 attribute would be fine. <BR><BR><variable name=3D"fooMsg"=20 messageType=3D"mywsdl:myFooMsgType" /> <BR><BR>By using messageType = attributes, the BPEL translator knows it will generate an anonymous = QNAME of=20 an XML Schema Element for "mywsdl:myFooMsgType". = <BR><BR>(III)<BR>"<I>2)=20 Introduce the bpel:partName attribute ...</I>"<BR><BR>I guess there is = no=20 collision for part name in general. Because, for a message part, we = are=20 generating a local element declaration and definition. The part name = does not=20 constitute a QNAME. The part name is a non-qualified local element=20 declaration. Using your example, "Details" and "MoreDetails" are not = qualified=20 elements. (Just like "product" element can have a "name" = subelement=20 which is a string of maxLength =3D 50, while "customer" element can = have a=20 "name" subelement which is a string of maxLength =3D 40.)<BR><BR>(IV) = XPath=20 Semantic Clarification:<BR><BR>If you look back to my proposal in item = (1):=20 <BR>"<I>The value of a BPEL variable, which appears as = Variable-Reference in=20 XPath 1.0, corresponds to a node-set of exactly one XML node in XPath = 1.0=20 semantics. The XML node corresponds to the <SPAN=20 style=3D"FONT-WEIGHT: bold">element node (not document node)</SPAN> of = related=20 BPEL variable ...</I>"<BR><BR>There is a big difference between = element node=20 or document node in terms of how XPath look like. <BR><BR>If we go for = a=20 document node, your XPath will be right:=20 <BR>"$BV/a:MT/a:Part/a:Element"<BR><BR>If we go for an element node, = the XPath=20 in the proposal will be right:<BR>"$BV/a:Part/a:Element"<BR><BR>Here = is a=20 little experiment that I run on XMLSpy to illustrate=20 = this:<BR><BR>emp_test.xslt<BR>----------------------------------<BR><?= xml=20 version=3D"1.0" encoding=3D"UTF-8"?><BR><xsl:stylesheet = version=3D"1.0"=20 xmlns:xsl=3D<A class=3Dmoz-txt-link-rfc2396E=20 = href=3D"http://www.w3.org/1999/XSL/Transform">"http://www.w3.org/1999/XSL= /Transform"</A>><BR> =20 <xsl:output method=3D"xml" version=3D"1.0" encoding=3D"UTF-8"=20 indent=3D"yes"/><BR> <xsl:template=20 match=3D"/employeeTag"><BR> =20 <xsl:variable name=3D"empVar" select=3D"." = /><BR> =20 <test><BR> = =20 <test1><xsl:value-of = select=3D"$empVar/@id"=20 /></test1><BR> =20 <test2><xsl:value-of = select=3D"$empVar/fname"=20 /></test2><BR> =20 <test3><xsl:value-of = select=3D"name($empVar)"=20 /></test3><BR> =20 </test><BR> =20 = </xsl:template><BR></xsl:stylesheet><BR>---------------------= -------------<BR><BR>emp.xml<BR>----------------------------------<BR><= ;?xml=20 version=3D"1.0" encoding=3D"UTF-8"?><BR><employeeTag=20 id=3D"101"><BR> =20 <fname>John</fname><BR> =20 = <lname>Dole</lname><BR></employeeTag><BR>--------------= --------------------<BR><BR>Execution=20 Result:<BR>----------------------------------<BR><?xml = version=3D"1.0"=20 encoding=3D"UTF-8"?><BR><test><BR> =20 <test1>101</test1><BR> =20 <test2>John</test2><BR> =20 = <test3>employeeTag</test3><BR></test><BR>--------------= --------------------<BR><BR>If=20 my proposal got accepted, we need to change Section 14.3 accordingly a = little=20 bit in the spec. <BR><BR>(V)<BR>From reading your appendix, I am glad = that you=20 also think getting rid of part names is a good idea.<BR>We are more or = less on=20 the same page = there.<BR><BR><BR>Thanks!<BR><BR><BR><BR>Regards,<BR>Alex=20 Yiu<BR></BLOCKQUOTE></BODY></HTML> ------_=_NextPart_001_01C475C5.A89411E6--
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]