org.jtool.jxplatform.j2x
Class Converter

java.lang.Object
  extended byorg.jtool.jxplatform.j2x.Converter

public class Converter
extends java.lang.Object

Converts source code to an XML document.

Author:
Katsuhisa Maruyama

Constructor Summary
Converter(JxProjectRepository repository)
          Creates a converter that generates an XML document from source code.
 
Method Summary
 void close()
          Closes the converter.
 void convert(org.eclipse.jdt.core.ICompilationUnit icu)
          Generates a DOM document object from input source code and resloves bindings.
 java.lang.String getCharsetName()
          Returns the name of the converted XML document's charset.
 org.w3c.dom.Document getDocument()
          Returns a DOM document object of the converted XML document.
 org.w3c.dom.Document parse(org.eclipse.jdt.core.ICompilationUnit icu)
          Parses input source code and generates its DOM document object.
 void setCharsetName(java.lang.String charset)
          Sets the name of an XML document's charset.
 void setDocument(org.w3c.dom.Document doc)
          Sets a DOM document object to be resolved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Converter

public Converter(JxProjectRepository repository)
Creates a converter that generates an XML document from source code.

Parameters:
repository - A repository of the current project.
Method Detail

close

public void close()
Closes the converter.


setDocument

public void setDocument(org.w3c.dom.Document doc)
Sets a DOM document object to be resolved.

Parameters:
doc - A DOM document object. Re-generating a new XML document will be done if this value is null. Only resolving bindings of the XML document will be done if a DOM document object is given.

getDocument

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

Returns:
The converted DOM document object.

setCharsetName

public void setCharsetName(java.lang.String charset)
Sets the name of an XML document's charset.

Parameters:
charset - A charset name. Detecting the charset name of the XML document will be skipped if this value is not null.

getCharsetName

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

Returns:
The name string of the document's charset.

convert

public void convert(org.eclipse.jdt.core.ICompilationUnit icu)
             throws JxException
Generates a DOM document object from input source code and resloves bindings.

Parameters:
icu - A compilation unit to be converted.
Returns:
true if the conversion succeeds, otherwise false.
Throws:
JxException - if an XML document was not generated.

parse

public org.w3c.dom.Document parse(org.eclipse.jdt.core.ICompilationUnit icu)
                           throws JxException
Parses input source code and generates its DOM document object.

Parameters:
icu - A compilation unit to be converted.
Returns:
The generated DOM document object.
Throws:
JxException - if the parsing fails.