jess.xml
Class XMLPrinter

java.lang.Object
  extended byjess.xml.XMLPrinter
All Implemented Interfaces:
Visitor

public class XMLPrinter
extends java.lang.Object
implements Visitor

Renders Jess constructs as JessML code. You can use this class in two ways: as a standalone application, it can translate a whole file of Jess code into JessML. Or inside a Java application, you can construct an XMLPrinter with a Jess construct as a constructor argument, then call toString() to get the JessML version. Any construct that implements Visitable can be rendered.

(C) 2005 Sandia National Laboratories

See Also:
Visitable

Constructor Summary
XMLPrinter(Visitable v)
          Create an XMLPrinter to render the given Visitable.
 
Method Summary
static void main(java.lang.String[] args)
          Reads a file of Jess code and emits equivalent XML on standard output.
 java.lang.String toString()
           
 java.lang.Object visitAccumulate(Accumulate accumulate)
           
 java.lang.Object visitDeffacts(Deffacts d)
           
 java.lang.Object visitDeffunction(Deffunction d)
           
 java.lang.Object visitDefglobal(Defglobal d)
           
 java.lang.Object visitDefmodule(Defmodule defmodule)
           
 java.lang.Object visitDefquery(Defquery d)
           
 java.lang.Object visitDefrule(Defrule d)
           
 java.lang.Object visitDeftemplate(Deftemplate d)
           
 java.lang.Object visitGroup(Group p)
           
 java.lang.Object visitPattern(Pattern p)
           
 java.lang.Object visitTest1(Test1 t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLPrinter

public XMLPrinter(Visitable v)
Create an XMLPrinter to render the given Visitable. When toString() is called on this object, it will return an XML version of the argument.

Parameters:
v - a construct or other Visitable to render
See Also:
Visitor
Method Detail

visitDeffacts

public java.lang.Object visitDeffacts(Deffacts d)
Specified by:
visitDeffacts in interface Visitor

visitDeftemplate

public java.lang.Object visitDeftemplate(Deftemplate d)
Specified by:
visitDeftemplate in interface Visitor

visitDeffunction

public java.lang.Object visitDeffunction(Deffunction d)
Specified by:
visitDeffunction in interface Visitor

visitDefglobal

public java.lang.Object visitDefglobal(Defglobal d)
Specified by:
visitDefglobal in interface Visitor

visitDefrule

public java.lang.Object visitDefrule(Defrule d)
Specified by:
visitDefrule in interface Visitor

visitDefquery

public java.lang.Object visitDefquery(Defquery d)
Specified by:
visitDefquery in interface Visitor

visitPattern

public java.lang.Object visitPattern(Pattern p)
Specified by:
visitPattern in interface Visitor

visitGroup

public java.lang.Object visitGroup(Group p)
Specified by:
visitGroup in interface Visitor

visitTest1

public java.lang.Object visitTest1(Test1 t)
Specified by:
visitTest1 in interface Visitor

visitAccumulate

public java.lang.Object visitAccumulate(Accumulate accumulate)
Specified by:
visitAccumulate in interface Visitor

visitDefmodule

public java.lang.Object visitDefmodule(Defmodule defmodule)
Specified by:
visitDefmodule in interface Visitor

toString

public java.lang.String toString()

main

public static void main(java.lang.String[] args)
                 throws java.io.FileNotFoundException,
                        JessException
Reads a file of Jess code and emits equivalent XML on standard output.

Parameters:
args - first argument is the path to a file of Jess code
Throws:
java.io.FileNotFoundException - if the file doesn't exist
JessException - if anything goes wrong

© 2006 Sandia Corporation