Java Reference
In-Depth Information
public
public class
class XmlForm
XmlForm {
protected
protected Reader is ;
protected
protected String fileName ;
protected
protected static
static PrintStream msg = System . out ;
/** Construct a converter given an input filename */
public
public XmlForm ( String fn ) {
fileName = fn ;
}
/** Convert the file */
public
public void
void convert ( boolean
boolean verbose ) {
try
try {
iif ( verbose )
System . err . println ( ">>>Parsing " + fileName + "..." );
// Make the document a URL so relative DTD works.
//String uri = "file:" + new File(fileName).getAbsolutePath();
InputStream uri = getClass (). getResourceAsStream ( fileName );
DocumentBuilderFactory factory =
DocumentBuilderFactory . newInstance ();
DocumentBuilder builder = factory . newDocumentBuilder ();
Document doc = builder . parse ( uri );
iif ( verbose )
System . err . println ( ">>>Walking " + fileName + "..." );
XmlFormWalker c = new
new GenMIF ( doc , msg );
c . convertAll ();
} catch
catch ( Exception ex ) {
System . err . println ( "+================================+" );
System . err . println ( "| *Parse Error* |" );
System . err . println ( "+================================+" );
System . err . println ( ex . getClass ());
System . err . println ( ex . getMessage ());
System . err . println ( "+================================+" );
}
iif ( verbose )
System . err . println ( ">>>Done " + fileName + "..." );
}
public
public static
void main ( String [] av ) {
iif ( av . length == 0 ) {
System . err . println ( "Usage: XmlForm file" );
return
static void
return ;
}
for
for ( int
int i = 0 ; i < av . length ; i ++) {
Search WWH ::




Custom Search