org.jtool.jxplatform.j2x.parser
Class JxParser

java.lang.Object
  extended byorg.jtool.jxplatform.j2x.parser.JxParser

public class JxParser
extends java.lang.Object

Parses source code and generates a fundamental XML document from it.

Author:
Katsuhisa Maruyama

Constructor Summary
JxParser(java.lang.String filename)
          Creates a parser with setting the name of source code to be parsed.
JxParser(java.lang.String filename, byte[] contents)
          Creates a parser with setting the name and contents of source code to be parsed.
JxParser(java.lang.String filename, java.lang.String contents, java.lang.String charsetName)
          Creates a parser with setting the name and the content of source code to be parsed.
 
Method Summary
 void close()
          Closes the parser.
 java.lang.String getCharsetName()
          Returns the name of a generated XML document's charset.
 org.w3c.dom.Document getDocument()
          Returns the DOM document object of a generated XML document.
 java.lang.String getMessage()
          Returns a message reported by the compiler during the parsing.
 java.lang.String getText()
          Returns the text of a generated XML document.
 boolean parse()
          Parses input source code by using JavaCC's JavaParser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JxParser

public JxParser(java.lang.String filename,
                java.lang.String contents,
                java.lang.String charsetName)
         throws java.io.IOException
Creates a parser with setting the name and the content of source code to be parsed.

Parameters:
filename - The name of an input source code.
contents - The textual contents of an input source code.
charsetName - The name of a content's charset.
Throws:
java.io.IOException - if it fails to create a parser.

JxParser

public JxParser(java.lang.String filename,
                byte[] contents)
         throws java.io.IOException
Creates a parser with setting the name and contents of source code to be parsed.

Parameters:
filename - The name of an input source code.
contents - The byte contents of an input source code.
Throws:
java.io.IOException - if it fails to create a parser.

JxParser

public JxParser(java.lang.String filename)
         throws java.io.IOException
Creates a parser with setting the name of source code to be parsed.

Parameters:
filename - The name of an input source code.
Throws:
java.io.IOException - if it fails to create a parser.
Method Detail

close

public void close()
Closes the parser.


getDocument

public org.w3c.dom.Document getDocument()
Returns the DOM document object of a generated XML document.

Returns:
The generated DOM document object.

getCharsetName

public java.lang.String getCharsetName()
Returns the name of a generated XML document's charset.

Returns:
The name string of document's charset.

getText

public java.lang.String getText()
Returns the text of a generated XML document.

Returns:
The text string of the generated XML document.

parse

public boolean parse()
Parses input source code by using JavaCC's JavaParser.

Returns:
true if the parsing succeeds, otherwise false.

getMessage

public java.lang.String getMessage()
Returns a message reported by the compiler during the parsing.

Returns:
The message, or possibly empty string.