commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gavin Lei <gavingui2...@gmail.com>
Subject Re: [SCXML] Do Apache Commons SCXML support XInclude and XPath 2.0?
Date Thu, 24 Feb 2011 02:04:56 GMT
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 ).

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 ?


[1] http://code.google.com/p/scxml4flex/

在 2011年2月24日 上午6:25,Rahul Akolkar <rahul.akolkar@gmail.com> 写道:
> 2011/2/23 Gavin Lei <gavingui2011@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: gavingui2011@gmail.com
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>



-- 
---------------------------------
Best Regards
Gavin Lei (雷银)
Email: gavingui2011@gmail.com

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


Mime
View raw message