How to write or reconfigure values of variables in o:xml?

Francisco <jshzhang2000-/[email protected]> Sun, 11 Mar 2007 14:59:05 +0000 (GMT)
Newsgroups gmane.text.xml.o-xml
Message-ID <[email protected]>
--===============0620112787==
Content-Type: multipart/alternative; boundary="0-1980942209-1173625145=:34157"
Content-Transfer-Encoding: 7bit

--0-1980942209-1173625145=:34157
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Dear Martin,
  =20
  How have  you been recently? Since I got your kind help weeks ago, I ha=
ve been working on the project and it seems there is another problem aris=
e when I come into the setVariableValue() methods which are defined into =
the o:xml.
  =20
  In the example you provided, the method "plus" just read the values and=
 sum them together, it is mainly a "read" process, however, we also need =
"write" process in the project, which means, the defined method setVariab=
leValue() should be able to reconfigure the values of the variables whene=
ver needed. As we know,  Java could "read" and "write" xml files via DOM =
tree, but I don't know how o:xml achieve this goal and couldn't find an e=
xample of it from all the currently available documents. I sincerely hope=
 you can help me out. I appreciate your help very much always.
  =20
  Looking forward to hearing from you.
  =20
  Kind regards,
  Francisco=20
  =20
  =20
  =20
 =20

Martin Klang <[email protected]> wrote:
  Francisco,

You need to match the function name and signature, in the same way as=20
when you call Class.getMethod(String, Class[]) in Java.

For example, if your function definition looks like this:








ie you've defined the function 'plus(Number, Number)', then you can=20
look up the function like this:

Function func =3D program.getResolver().getFunction(new Name("plus"),=20
new Type[]{NumberNode.TYPE, NumberNode.TYPE});

I have put together a couple of working examples that you can=20
download from here:
http://mars.pingdynasty.com/CallObjectboxExamples.zip

You need to have the latest objectbox.jar on your classpath to=20
compile and run the Java program.

best of luck, I look forward to hearing of your success!

/m


On 26 Feb 2007, at 16:16, Francisco wrote:

> Dear Martin,
>
> Sorry to bother you again. I have the difficulty in following your=20
> example to call the functions. The problem is mainly on this line=20
> -----
>
> Function func =3D program.getResolver().getFunction=20
> (functionName,signature);
>
> I always get "null" as return, I don't know how to solve it. I=20
> checked the API but couldn't find more details on how to pass the=20
> arguments or signatures for designated functions? I tried to put=20
> signatures inside. But still not succeed. Could you please kindly=20
> give a further explaination on this? Thank you very much for your=20
> help.
>
> Looking forward to your email.
>
> Kind regards,
> Francisco
>


 	=09
---------------------------------
 Copy addresses and emails from any email account to Yahoo! Mail - quick,=
 easy and free. Do it now...
--0-1980942209-1173625145=:34157
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Dear Martin,</div>  <div>&nbsp;</div>  <div>How have&nbsp; you been =
recently? Since I got your kind help weeks ago, I have been working on th=
e project and it seems there is another problem arise when I come into th=
e setVariableValue() methods which are defined into the o:xml.</div>  <di=
v>&nbsp;</div>  <div>In the example you provided,&nbsp;the method&nbsp;"p=
lus" just read the values and sum them together, it is mainly a "read" pr=
ocess, however, we&nbsp;also need&nbsp;"write" process in the project, wh=
ich means, the defined method <STRONG>setVariableValue() </STRONG>should =
be able to&nbsp;reconfigure the values of the variables whenever needed.&=
nbsp;As we know, &nbsp;Java could "read" and "write" xml files via DOM tr=
ee, but I don't know how o:xml achieve this goal and couldn't find an exa=
mple of it from all the currently available&nbsp;documents. I sincerely h=
ope&nbsp;you can help me out. I appreciate&nbsp;your help very much alway=
s.</div>  <div>&nbsp;</div>=20
 <div>Looking forward to hearing from you.</div>  <div>&nbsp;</div>  <div=
>Kind regards,</div>  <div>Francisco&nbsp;</div>  <div>&nbsp;</div>  <div=
>&nbsp;</div>  <div>&nbsp;</div>  <div><BR><BR><B><I>Martin Klang &lt;mar=
[email protected]&gt;</I></B> wrote:</div>  <BLOCKQUOTE class=3Dreplbq style=3D=
"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Fra=
ncisco,<BR><BR>You need to match the function name and signature, in the =
same way as <BR>when you call Class.getMethod(String, Class[]) in Java.<B=
R><BR>For example, if your function definition looks like this:<BR><?xml:=
namespace prefix =3D o /><o:function name=3D"plus"><BR><o:param type=3D"N=
ode" name=3D"lhs"></o:param><BR><o:param type=3D"Node" name=3D"rhs"></o:p=
aram><BR><o:do><BR><o:return select=3D"$lhs + $rhs"></o:return><BR></o:do=
><BR></o:function><BR><BR>ie you've defined the function 'plus(Number, Nu=
mber)', then you can <BR>look up the function like this:<BR><BR>Function =
func =3D program.getResolver().getFunction(new
 Name("plus"), <BR>new Type[]{NumberNode.TYPE, NumberNode.TYPE});<BR><BR>=
I have put together a couple of working examples that you can <BR>downloa=
d from here:<BR>http://mars.pingdynasty.com/CallObjectboxExamples.zip<BR>=
<BR>You need to have the latest objectbox.jar on your classpath to <BR>co=
mpile and run the Java program.<BR><BR>best of luck, I look forward to he=
aring of your success!<BR><BR>/m<BR><BR><BR>On 26 Feb 2007, at 16:16, Fra=
ncisco wrote:<BR><BR>&gt; Dear Martin,<BR>&gt;<BR>&gt; Sorry to bother yo=
u again. I have the difficulty in following your <BR>&gt; example to call=
 the functions. The problem is mainly on this line <BR>&gt; -----<BR>&gt;=
<BR>&gt; Function func =3D program.getResolver().getFunction <BR>&gt; (fu=
nctionName,signature);<BR>&gt;<BR>&gt; I always get "null" as return, I d=
on't know how to solve it. I <BR>&gt; checked the API but couldn't find m=
ore details on how to pass the <BR>&gt; arguments or signatures for desig=
nated functions? I tried to put <BR>&gt;
 signatures inside. But still not succeed. Could you please kindly <BR>&g=
t; give a further explaination on this? Thank you very much for your <BR>=
&gt; help.<BR>&gt;<BR>&gt; Looking forward to your email.<BR>&gt;<BR>&gt;=
 Kind regards,<BR>&gt; Francisco<BR>&gt;<BR></BLOCKQUOTE><BR><p>&#32;
		<hr size=3D1>=20
Copy addresses and emails from any email account to Yahoo! Mail - quick, =
easy and free. <a href=3D"http://us.rd.yahoo.com/mail/uk/taglines/yahoo_c=
o_uk/trueswitch/*http://uk.docs.yahoo.com/trueswitch2.html">Do it now...<=
/a>
--0-1980942209-1173625145=:34157--

--===============0620112787==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
o-xml mailing list
o-xml-zRfLyl9bSvv/[email protected]
http://lists.pingdynasty.com/mailman/listinfo/o-xml

--===============0620112787==--