##### Commons SCXML Resources

- Overview
- User Guide
  - SCXML documents
  - Using Commons SCXML
  - Standalone Testing
  - SCXML Digester
  - SCXML datamodel
  - Contexts and Evaluators
  - SCXML Engine
  - Triggering Events
  - Custom Actions
  - Custom Semantics
  - Side Effect - EL
- Javadoc
- FAQ
- Usecases
- Building
- Dependencies
- Mailing lists
- Team
- SVN repository
- Nightly snapshots

##### Releases

- Version 0.6
- Version 0.5

##### Project Documentation

- About SCXML
- Project Info
- Project Reports
- Development Process

##### Commons

- Home
- Components
- Sandbox
- Dormant
- Volunteering
- Contributing Patches
- Building Components
- Releasing Components
- Wiki

## Commons SCXML - Digesting SCXML documents for Commons SCXML

Commons SCXML provides its own implementation of the Java object model for SCXML and a configured Digester that can digest SCXML documents into that object model.

### Usage

The primary convenience method exposed by the `SCXMLDigester` is:

            //import java.io.IOException;
            //import java.net.URL;
            //import org.apache.commons.scxml.io.SCXMLDigester;
            //import org.apache.commons.scxml.model.ModelException;
            //import org.apache.commons.scxml.model.SCXML;
            //import org.xml.sax.ErrorHandler;
            //import org.xml.sax.SAXException;

            SCXML scxml = null;

            try {
              scxml = SCXMLDigester.digest(<URL>, <ErrorHandler>);
            } catch (IOException ioe) {
              // IOException while parsing
            } catch (SAXException se) {
              // SAXException while parsing
            } catch (ModelException me) {
              // ModelException while parsing
            }

            if (scxml == null) {
              // Digestion failed
            }

It returns an `SCXML` object, which is the state machine / chart represented in the Commons SCXML Java object model. This method uses the `URL` of the initial SCXML document to resolve any relative URLs referenced by the document, such as `src` attributes of `State` SCXML elements.

Commons SCXML provides convenience implementations of most of the interfaces such as `ErrorHandler`.

The SCXMLDigester exposes other convenience methods which can handle a SCXML document specified using its "real path" on the local system, in which case an additional `org.apache.commons.SCXML.PathResolver`parameter needs to be supplied for resolving relative document references or as an `InputSource`, in which case there is no path resolution, so the document must be a standalone document.

The `SCXMLDigester` Javadoc is available here.

### API notes set

The next note in this set describes the SCXML engine.