在JAVA里怎么验证一个String是否能作为XML Element?

2024-12-01 22:35:21
推荐回答(1个)
回答1:

String s="tagName";
if(s.matches("\\w+")){//用这个判断
//可以作为标签名
}else{
//不可以
}