You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by gu...@hotmail.com on 2008/09/24 17:02:35 UTC

how can i Read, edit and write scxml-documents?

i am new in commons scxml and want to load a scxml-document from  system and parse it to Java object,then edit it and output the edited document. how can i proceed ? 
example: i have the following document: NewText.xml

 <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="reset">
- <state id="reset">
  <transition event="watch.start" target="running" /> 
  </state>
- <state id="running">
  <transition event="watch.split" target="paused" /> 
  </state>
- <state id="paused">
  <transition event="watch.unsplit" target="running" /> 
  <transition event="watch.stop" target="stopped" /> 
  </state>
- <state id="stopped">
  <transition event="watch.reset" target="reset" /> 
  </state>
  </scxml>

and want to load it a and the transition: 
<transition event="watch.stop" target="stopped" /> 
then create a new document newtext_1.xml an write the result inside.

thanks for your help in advance

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


Re: [scxml] how can i Read, edit and write scxml-documents?

Posted by James Carman <ja...@carmanconsulting.com>.
You might want to look at the JDom or DOM APIs.  You could load your
object into a DOM tree, modify it, and then export it out to a stream.

On Wed, Sep 24, 2008 at 11:02 AM,  <gu...@hotmail.com> wrote:
> i am new in commons scxml and want to load a scxml-document from  system and parse it to Java object,then edit it and output the edited document. how can i proceed ?
> example: i have the following document: NewText.xml
>
>  <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="reset">
> - <state id="reset">
>  <transition event="watch.start" target="running" />
>  </state>
> - <state id="running">
>  <transition event="watch.split" target="paused" />
>  </state>
> - <state id="paused">
>  <transition event="watch.unsplit" target="running" />
>  <transition event="watch.stop" target="stopped" />
>  </state>
> - <state id="stopped">
>  <transition event="watch.reset" target="reset" />
>  </state>
>  </scxml>
>
> and want to load it a and the transition:
> <transition event="watch.stop" target="stopped" />
> then create a new document newtext_1.xml an write the result inside.
>
> thanks for your help in advance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

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


Re: how can i Read, edit and write scxml-documents?

Posted by Romualdo Rubens de Freitas <ro...@gmail.com>.
Using DOM you have to deal with low-level and error prone programming.
If SCXML document structure is known (give a look at its docs) you can use
Commons Betwixt to read (BeanReader) and write (BeanWrite) the document.

[]s

2008/9/24  <gu...@hotmail.com>:
> i am new in commons scxml and want to load a scxml-document from  system and parse it to Java object,then edit it and output the edited document. how can i proceed ?
> example: i have the following document: NewText.xml
>
>  <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="reset">
> - <state id="reset">
>  <transition event="watch.start" target="running" />
>  </state>
> - <state id="running">
>  <transition event="watch.split" target="paused" />
>  </state>
> - <state id="paused">
>  <transition event="watch.unsplit" target="running" />
>  <transition event="watch.stop" target="stopped" />
>  </state>
> - <state id="stopped">
>  <transition event="watch.reset" target="reset" />
>  </state>
>  </scxml>
>
> and want to load it a and the transition:
> <transition event="watch.stop" target="stopped" />
> then create a new document newtext_1.xml an write the result inside.
>
> thanks for your help in advance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>



-- 
=> Romualdo Rubens de Freitas, M.Sc.
=> Professor do Curso Superior em
 Desenvolvimento de Sistemas de Informação
=> Professor Responsavel pelas Atividades
 de Estagio (PRAE)
=> Coordenador da IV Turma do Curso de
 Especialização em Projeto e
 Desenvolvimento de Sistemas Baseados
 em Objetos para Ambiente Internet

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