dk.brics.xsugar
Class Main

java.lang.Object
  extended by dk.brics.xsugar.Main

public class Main
extends Object

Command-line interface.


Method Summary
static void analyzeReversibility(String xsg_file, String xsg, String xsg_encoding, boolean verbose, int left_unfold_level, String left_unfold_left, String left_unfold_right, boolean tokenize)
          Analyzes reversibility.
static void analyzeValidity(String xsg_file, String xsg, String xsg_encoding, String schema, String schema_root, boolean verbose)
          Analyzes validity.
static void main(String[] args)
          Main method.
static void setOut(PrintWriter out)
          Sets output print writer.
static String transformFromXML(String xsg_file, String xsg, String xsg_encoding, String xml, boolean verbose)
          Transforms from XML to non-XML.
static String transformToXML(String xsg_file, String xsg, String xsg_encoding, String txt, boolean verbose)
          Transforms from non-XML to XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

analyzeReversibility

public static void analyzeReversibility(String xsg_file,
                                        String xsg,
                                        String xsg_encoding,
                                        boolean verbose,
                                        int left_unfold_level,
                                        String left_unfold_left,
                                        String left_unfold_right,
                                        boolean tokenize)
                                 throws IOException,
                                        XSugarException,
                                        InstantiationException,
                                        IllegalAccessException,
                                        ClassNotFoundException
Analyzes reversibility.

Parameters:
xsg_file - name of XSugar stylesheet
xsg - XSugar stylesheet
xsg_encoding - character encoding of stylesheet files
verbose - verbose output if true
left_unfold_level - unfold number (only for left grammar!)
left_unfold_left - unfolding left parentheses symbols
left_unfold_right - unfolding right parentheses symbols
tokenize - if true, tokenize grammars before ambiguity analysis
Throws:
IOException - if I/O error occurs
XSugarException - if the XSugar stylesheet is illegal
ClassNotFoundException - if unable to perform ambiguity analysis
IllegalAccessException - if unable to perform ambiguity analysis
InstantiationException - if unable to perform ambiguity analysis
See Also:
setOut(PrintWriter)

analyzeValidity

public static void analyzeValidity(String xsg_file,
                                   String xsg,
                                   String xsg_encoding,
                                   String schema,
                                   String schema_root,
                                   boolean verbose)
                            throws IOException,
                                   XSugarException,
                                   ParseException
Analyzes validity.

Parameters:
xsg_file - name of XSugar stylesheet
xsg - XSugar stylesheet
xsg_encoding - character encoding of stylesheet files
schema - URL or path of schema
schema_root - schema_root root element (on the form {namespaceURI}localname), if null then auto-detect (for DTD) or use all globally defined (for XML Schema)
verbose - verbose output if true
Throws:
IOException - if I/O error occurs
XSugarException - if the XSugar stylesheet is illegal
ParseException
See Also:
setOut(PrintWriter)

main

public static void main(String[] args)
Main method. Run without arguments to see usage.


setOut

public static void setOut(PrintWriter out)
Sets output print writer. Default is System.out with default encoding.

Parameters:
out - print writer for output

transformFromXML

public static String transformFromXML(String xsg_file,
                                      String xsg,
                                      String xsg_encoding,
                                      String xml,
                                      boolean verbose)
                               throws IOException,
                                      XSugarException,
                                      ParseException
Transforms from XML to non-XML.

Parameters:
xsg_file - name of XSugar stylesheet
xsg - XSugar stylesheet
xsg_encoding - character encoding of stylesheet files
xml - XML document
verbose - verbose output if true
Returns:
resulting text
Throws:
IOException - if I/O error occurs
XSugarException - if the XSugar stylesheet is illegal
ParseException - if parse error occurs in input

transformToXML

public static String transformToXML(String xsg_file,
                                    String xsg,
                                    String xsg_encoding,
                                    String txt,
                                    boolean verbose)
                             throws IOException,
                                    XSugarException,
                                    ParseException
Transforms from non-XML to XML.

Parameters:
xsg_file - name of XSugar stylesheet
xsg - XSugar stylesheet
xsg_encoding - character encoding of stylesheet files
txt - input text
verbose - verbose output if true
Returns:
resulting XML document
Throws:
IOException - if I/O error occurs
XSugarException - if the XSugar stylesheet is illegal
ParseException - if parse error occurs in input


Copyright © 2004-2007 Anders Møller & Claus Brabrand.