Composing the XML Data

An MMS client may choose to use the SMIL composer to generate the presentation part of outgoing messages, alternatively, it may use template SMIL files. The first option results in a more flexible MMS composer, while the second may be easier to implement.

Procedure

  1. Build a DOM tree.

  2. Generate XML data from the DOM tree.

Build a DOM tree

The following steps are required to build the DOM tree:

  1. Create a CMDXMLDocument object.

  2. Validate it using any of the following methods, if required.

    • To validate SMIL data as it is parsed, an instance of the SMIL DTD class must be passed to the CMDXMLParser on construction.

    • To validate SMIL composition, the SMIL DTD class must be passed to the CMDXMLDocument on construction.

    Note: The DTD class provided standard is the SMIL DTD; however it is possible to implement others. In order to provide support for validating other DTDs, it is necessary to derive a class from MXMLDtd.

  3. Call CMDXMLDocument::DocumentElement() to get the root node of the DOM tree.

  4. Create a child node of the required type, for example CMDXMLElement or CMDXMLComment.

  5. Add the node using CMDXMLNode::AppendChild().

  6. The tree can be navigated as above, as more child nodes are added.

    Nodes can also be manipulated by using the following functions:

Generate XML data from the DOM tree

Once the DOM tree has been built it can be used to generate the XML data. The following steps must be followed to compose the data:

  1. Create an instance of CMDXMLComposer, passing in an observer.

  2. Call CMDXMLComposer::ComposeFile(), passing in the name of the file where the XML data is to be written.

  3. The composer calls the MMDXMLComposerObserver::ComposeFileCompleteL() function on the observer when it has completed. The observer can then check the composer to see if the XML has been generated successfully.