CellML Discussion List

Text archives Help


[cellml-discussion] (no subject)


Chronological Thread 
  • From: Andrew Miller <ak.miller AT auckland.ac.nz>
  • To: cellml-discussion AT cellml.org
  • Subject: [cellml-discussion] (no subject)
  • Date: Sat, 5 Mar 2005 17:40:19 +1300
  • List-archive: <http://www.cellml.org/pipermail/cellml-discussion>
  • List-id: "For those interested in contributing to the development of CellML." <cellml-discussion.cellml.org>

Please find attached a draft XML Schema Definition for CellML 1.1. It is in a
tar file including the MathML XSDs from W3C(with a trivial modification so
that
the toplevel math element can't contain presentation elements).

I also attached a small Java program which can be used to validate against the
XSD. You need Xerces-J to use this.

Usage:
java SchemaValidator "http://www.cellml.org/cellml/1.1# cellml_1_1.xsd"
model.xml
You have to either give a full file URL to the XSD, or otherwise put the model
in the same directory as the XSD.

Best regards,
Andrew


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
import java.util.*;
import java.io.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;

public class SchemaValidator
{
  public static void main(String argv[])
    throws SAXException, IOException
  {
    if (argv.length < 2)
    {
      System.out.println("Usage: SchemaValidator schema document");
      return;
    }
    XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
    parser.setProperty(
                       "http://apache.org/xml/properties/schema/external-schemaLocation";,
                       argv[0]
                      );
    parser.setFeature(
                      "http://xml.org/sax/features/validation";,
                      true
                     );
    parser.setFeature(
                      "http://apache.org/xml/features/validation/schema";,
                      true
                     );
    parser.setErrorHandler(new ErrorHandler()
    {
      public void warning(SAXParseException exception)
        throws SAXParseException
      {
        System.out.println("A warning occurred.");
        // throw exception;
      }

      public void error(SAXParseException exception)
        throws SAXParseException
      {
        System.out.println("SAX Error: Line " +
                           exception.getLineNumber() + 
                           " column " +
                           exception.getColumnNumber() +
                           ": " +
                           exception.getMessage()
                          );
        System.exit(-1);
      }

      public void fatalError(SAXParseException exception)
        throws SAXParseException
      {
        System.out.println("SAX Fatal Error: Line " +
                           exception.getLineNumber() + 
                           " column " +
                           exception.getColumnNumber() +
                           ": " +
                           exception.getMessage()
                          );
        System.exit(-1);
      }
    }
                          );
    parser.parse(argv[1]);
  }
};

Attachment: CellML_1_1_xsds.tar.gz
Description: GNU Zip compressed data



  • [cellml-discussion] (no subject), Andrew Miller, 03/05/2005

Archive powered by MHonArc 2.6.18.

Top of page