2011/2/23 Gavin Lei <gavingui2...@gmail.com>:
> Hi Rahul,
>
> Thank you for your answer. It means that we can take some measures to
> support XInclude and XPath 2.0 in Commons SCXML. Commons SCXML use
> Digester to support XInclude and use JDK's API to support XPath( In my
> memory, JDK use Apache Xalan library to support XPath, so there's a
> small question, Xalan support XPath 1.0 only, may be Commons SCXML
> support XPath 1.0 only ).
>
<snip/>

I pointed to an Evaluator that uses javax.xml.xpath in the previous
email. Similarly, one could author an Evaluator impl that uses Saxon,
for example, to get XPath 2.0 support. Evaluators are meant to be
pluggable (with corresponding Context impls) in Commons SCXML.


> Nowadays, I am developing a Flex ActionScript SCXML engine --
> SCXML4Flex [1], we have finished some basic functions (such as SCXML
> document parse job, custom action support ) for it. In the future,
> there are still three milestones for this project: XInclude support,
> XPath 2.0 support andEvent I/O Processors support. So, you have been
> working with SCXML for years, do you have any suggestions about these
> features ?
>
<snap/>

We've talked about XInclude and XPath 2.0 already in this thread.
Commons SCXML doesn't provide all the I/O processors yet (in the
manner described in the spec), so don't have much to add there.

-Rahul


>
> [1] http://code.google.com/p/scxml4flex/
>
> 在 2011年2月24日 上午6:25,Rahul Akolkar <rahul.akol...@gmail.com> 写道:
>> 2011/2/23 Gavin Lei <gavingui2...@gmail.com>:
>>> Hi guys,
>>> Do Apache Commons SCXML support XInclude and XPath 2.0? Today i want
>>> to do some experiments to confirm this, but it seems that Commons
>>> SCXML does not support XInclude and XPath 2.0.
>>> 1. about XInclude
>>> I try to run such a SCXML document in Commons SCXML engine:
>>>
>>> <scxml initial="s1" xmlns:xi="http://www.w3.org/2001/XInclude";>
>>> <xi:include href="datamodel.xml" parse="xml"/>
>>> <state id="s1">
>>> <onentry>
>>> <script>x = x + 5;</script>
>>> </onentry>
>>>        <transition cond="x &gt; 1" target="print">
>>> </transition>
>>>    </state>
>>>    <state id="print">
>>>     <onexit>
>>>     <log label="Result" expr="x"/>
>>>     </onexit>
>>>     <transition event="result" target="result" />
>>>    </state>
>>>   <final id="result"/>
>>> </scxml>
>>>
>>> datamodel.xml:
>>>
>>> <datamodel>
>>> <data id="x" expr="1"/>
>>> </datamodel>
>>>
>>> But it seems that Commons SCXML does not work for me. So, i want to
>>> confirm that Commons SCXML support XInclude or not.
>>>
>> <snip/>
>>
>> It (the last release) doesn't, but it won't be difficult to add. The
>> last release used Commons Digester for parsing. Since then, Digester
>> has added XInclude support, so the actual change now necessary to the
>> SCXMLParser class is minimal.
>>
>> It may be possible to parse documents containing XInclude using the
>> new and unreleased parser class (i.e. SCXMLReader in the J6 branch in
>> SVN) by passing the appropriate inputs/options to the StAX parser.
>>
>>
>>> 2, about XPath 2.0
>>> In W3C's SCXML recommendation specification, it show that SCXML engine
>>> should support XPath 2.0 and XPath 2.0 functions. And i tried a SCXML
>>> document with this State in it:
>>>
>>> <state id="errorSwitch" xmlns:fn="http://www.w3.org/2005/xpath-functions";>
>>>  <datamodel>
>>>    <data id="time"/>
>>>  </datamodel>
>>>
>>>  <onentry>
>>>    <assign location="$time" expr="fn:current-dateTime()"/>
>>>  </onentry>
>>>
>>>  <transition cond="fn:year-from-dateTime($time) > 2009" 
>>> target="newBehavior"/>
>>>  <transition target="currentBehavior"/>
>>> </state>
>>>
>>>
>>>
>>> But it seems that Commons SCXML does not work for me too. I think
>>> XInclude and XPath support are both very importmant in SCXML
>>> application.  So i want to confirm Commons SCXML support these
>>> features or not. If yes, how can we use them ? If not, may be we can
>>> do something to improve Commons SCXML. Thank You.
>>>
>> <snap/>
>>
>> You may use an XPathEvaluator like the one below and pass in the
>> functions you want supported (see 2nd constructor which takes a map,
>> for how arbitrary XPath functions support may be added):
>>
>> http://svn.apache.org/repos/asf/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/env/xpath/XPathEvaluator.java
>>
>> -Rahul
>>
>>
>>> --
>>> ---------------------------------
>>> Best Regards
>>> Gavin Lei (雷银)
>>> Email: gavingui2...@gmail.com
>>>
>>
> --
> ---------------------------------
> Best Regards
> Gavin Lei (雷银)
> Email: gavingui2...@gmail.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to