} // end while
} // end parse()
private static void parseAttList(String in,final Map knownElement) {
in = in.substring("!ATTLIST".length()).trim();
String elementName = new CStringTokenizer(in," \n\r\t",false).nextToken();
CElement elem = (CElement)knownElement.get(elementName);
if (elem == null) {
elem = new CElement(elementName,"*");
knownElement.put(elementName,elem);
}
in = in.substring(in.indexOf(elementName)+elementName.length()).trim();
while (in.length() > 0) {
String attrName = new CStringTokenizer(in," \n\r\t",false).nextToken();
in = in.substring(in.indexOf(attrName)+attrName.length()).trim();
String type = null;
if (in.startsWith("(")) {
type = in.substring(0,in.indexOf(")")+1);
} else {
type = new CStringTokenizer(in," \n\r\t",false).nextToken();
}
in = in.substring(in.indexOf(type)+type.length()).trim();
String defaultValue = null;
if (in.startsWith("\"") ||
in.startsWith("'")) {
in = in.substring(1);
int index = in.indexOf("\"");
if (index == -1 || (in.indexOf("'") > -1 && in.indexOf("'") < index))
index = in.indexOf("'");
defaultValue = in.substring(0,index);
in = in.substring(index+1);
} else {
defaultValue = new CStringTokenizer(in," \n\r\t",false).nextToken();
in = in.substring(in.indexOf(defaultValue)+defaultValue.length()).trim();
}
if (defaultValue.startsWith("#FIXED")) {
if (in.startsWith("\"") ||
in.startsWith("'")) {
in = in.substring(1);
int index = in.indexOf("\"");
if (index == -1 || (in.indexOf("'") > -1 && in.indexOf("'") < index))
index = in.indexOf("'");
defaultValue = in.substring(0,index);
in = in.substring(index+1);
} else {
defaultValue = new CStringTokenizer(in," \n\r\t",false).nextToken();
in = in.substring(in.indexOf(defaultValue)+defaultValue.length()).trim();
}
}
if ("CDATA".equals(type)) {
elem.addAttribute(attrName,CElement.CDATA,defaultValue,null);