有我的实际解决方案,将值添加到一个HashMap字符串转换为
private HashMap<String,Sexpr> contexte = new HashMap<String,Sexpr>();
...
this.putVariable("car",Car.CAR);
this.putVariable("cdr",Cdr.CDR);
我想通过使用SAX
<root>
<!-- Les types prédéfinis -->
<type symbole="car" type="expr" class="Car.CAR"/>
<type symbole="cdr" type="expr" class="Cdr.CDR"/>
</root>
做从XML同样的事情我可以通过使用 attributes.getValue(i).toString()从我的处理程序(使用Sax)中获取这些值,我想将我的字符串转换为Java代码,以便访问我的类Car或在这个例子中的Cdr
X.putVariable(attributes.getValue(0).toString, attributes.getValue(2).?);
谢谢您的帮助
我建议改变这个问题的题目,表示要映射一个字符串转换为Java对象:
现在,你可以使用它。 – hcpl 2012-03-29 16:08:25