com.palserv.XMidi
Class XM

java.lang.Object
  |
  +--com.palserv.XMidi.XM

public class XM
extends java.lang.Object

Convert an XMidi file (XML) to a midi file.

This class can be used in two ways:

  1. From the command line.
  2. From another java class:
    1. Create an array of Strings which will correspond to the command line arguments.
    2. Pass the array to the constructor:
       XM xm = new XM(args);
       
    3. Invoke the main conversion method:
       xm.xMidiToMidi();
       
      or invoke one of the two sub-methods:
       Document xDoc = xMidiToDoc("blah.xmi");
       
      or
       docToMidi(xDoc, "blah.mid");
       

Even though the XMidi format has a DTD (XMidi.dtd) associated with it, this program does quite a bit of its own validation. This may be somewhat redundant, but it will allow the program to work on an XMidi file which does not name a DTD. The validation forces many of the same things as the DTD, although there are differences.

Author:
Peter Arthur Loeb

Constructor Summary
XM(java.lang.String[] args)
          public constructor Takes "command line" arguments.
 
Method Summary
 void docToMidi(org.w3c.dom.Document xDoc, java.lang.String outFile)
          Traverse a DOM structure and produce a MIDI file.
static void main(java.lang.String[] args)
          This method is for command line invocation.
 org.w3c.dom.Document xMidiToDoc(java.lang.String fid)
          Read in a XMidi file (XML) and produce a DOM structure.
 void xMidiToMidi()
          Convert an XMidi file (XML) to a midi file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XM

public XM(java.lang.String[] args)
public constructor Takes "command line" arguments. see the Util.getCmdLine method for details. Also, see the main package description for details about external parsers.
Parameters:
String[] - args - command line arguments (as in main)
Method Detail

xMidiToMidi

public void xMidiToMidi()
Convert an XMidi file (XML) to a midi file. Uses the two "sub-methods" xMidiToDoc and docToMidi

xMidiToDoc

public org.w3c.dom.Document xMidiToDoc(java.lang.String fid)
Read in a XMidi file (XML) and produce a DOM structure. Use an external parser to do this. See the main package description for details about external parsers.
Parameters:
String - fid - name of input (XMidi) file.
Returns:
Document

docToMidi

public void docToMidi(org.w3c.dom.Document xDoc,
                      java.lang.String outFile)
Traverse a DOM structure and produce a MIDI file.
Parameters:
Document - xDoc - the DOM Document for the DOM structure
String - outFile - the file name of the output (MIDI) file.

main

public static void main(java.lang.String[] args)
This method is for command line invocation. See the Util.getCmdLine method for details of the command line syntax.
Parameters:
String[] - args - command line