wt.util.xml
Class PrepMapFile
java.lang.Object
wt.util.xml.PrepMapFile
- public class PrepMapFile
- extends Object
Method Summary |
private void |
addElement(String name)
|
static String |
doEncoding(String startString)
|
private String |
doSuperTag(String str)
|
private void |
doTopLevel(Enumeration keys,
StringBuffer buff)
|
void |
generateLoadFile(File outputDir,
File inDir,
String inFile)
|
void |
generateLoadFile(File outputDir,
File inDir,
String inFile,
String token)
|
StringBuffer |
generateLoadFile(String fname)
Given a csv load file name, generates an XML version of it. |
StringBuffer |
generateLoadFile(String fname,
String token)
|
String |
getDtd()
|
StringBuffer |
getDtdBuff()
|
private boolean |
isElementNew(String elem)
|
void |
makeDtd()
Generates a DTD corresponding to the constraints in the mapfile. |
StringBuffer |
processCsvFile(BufferedReader br)
|
StringBuffer |
processCsvFile(BufferedReader br,
String token)
|
private String |
processCsvLine(String str,
String token)
|
private void |
processEntities(String key)
|
void |
processFile()
|
private void |
processLine(String str)
|
private String |
replaceSpaceByUnderScore(String str)
|
private String |
substStr(String inStr,
String key,
String repl)
|
private void |
testDecoding(StringBuffer testBuff,
String origStr)
|
String |
toString()
|
private void |
validateState()
|
void |
writeTemplateDB(PrintWriter out)
Writes out mapping between entities and handlers to a file. |
_file
private File _file
_outBuff
private StringBuffer _outBuff
_dtdBuff
private StringBuffer _dtdBuff
_nl
private String _nl
beg
private static final String beg
- See Also:
- Constant Field Values
end
private static final String end
- See Also:
- Constant Field Values
_entityMap
static Hashtable _entityMap
_substMap
static Hashtable _substMap
VERBOSE
private static boolean VERBOSE
space
private static final String space
- See Also:
- Constant Field Values
PrepMapFile
public PrepMapFile(String fname)
processFile
public void processFile()
throws IOException
- Throws:
IOException
makeDtd
public void makeDtd()
throws IOException
- Generates a DTD corresponding to the constraints in the mapfile.
The generated DTD can be modified to incorporate any attribute
constraints which should be enforced for import.
We are interested in reproducting the behaviour of the
existing csv file so we are going to assign a sequence
number to each of the attribute sets which corresponds
to its index in the csv file.
- Throws:
IOException
getDtdBuff
public StringBuffer getDtdBuff()
throws WTException
- Throws:
WTException
isElementNew
private boolean isElementNew(String elem)
writeTemplateDB
public void writeTemplateDB(PrintWriter out)
throws IOException
- Writes out mapping between entities and handlers to a file.
Used for prototyping Template processor.
- Throws:
IOException
processEntities
private void processEntities(String key)
addElement
private void addElement(String name)
doTopLevel
private void doTopLevel(Enumeration keys,
StringBuffer buff)
getDtd
public String getDtd()
toString
public String toString()
processLine
private void processLine(String str)
replaceSpaceByUnderScore
private String replaceSpaceByUnderScore(String str)
doSuperTag
private String doSuperTag(String str)
generateLoadFile
public StringBuffer generateLoadFile(String fname)
throws IOException,
FileNotFoundException,
Exception
- Given a csv load file name, generates an XML version of it.
- Throws:
IOException
FileNotFoundException
Exception
generateLoadFile
public void generateLoadFile(File outputDir,
File inDir,
String inFile)
throws IOException,
Exception
- Throws:
IOException
Exception
generateLoadFile
public StringBuffer generateLoadFile(String fname,
String token)
throws IOException,
FileNotFoundException,
Exception
- Throws:
IOException
FileNotFoundException
Exception
generateLoadFile
public void generateLoadFile(File outputDir,
File inDir,
String inFile,
String token)
throws IOException,
Exception
- Throws:
IOException
Exception
processCsvFile
public StringBuffer processCsvFile(BufferedReader br)
throws IOException,
Exception
- Throws:
IOException
Exception
processCsvFile
public StringBuffer processCsvFile(BufferedReader br,
String token)
throws IOException,
Exception
- Throws:
IOException
Exception
processCsvLine
private String processCsvLine(String str,
String token)
throws Exception
- Throws:
Exception
doEncoding
public static String doEncoding(String startString)
testDecoding
private void testDecoding(StringBuffer testBuff,
String origStr)
substStr
private String substStr(String inStr,
String key,
String repl)
validateState
private void validateState()
throws IOException
- Throws:
IOException