📄 mapnametyperule.java
字号:
/*
* MapNameTypeRule.java
*
* Created on 11 December 2002, 12:18
*/
package ke.defaultimpl.utils.xml.parsing;
import java.util.*;
/**
*
* @author james
*/
public class MapNameTypeRule extends org.apache.commons.digester.Rule
{
/** Creates a new instance of MapNameTypeRule */
public MapNameTypeRule() {}
public void begin(String namespace, String name, org.xml.sax.Attributes attributes)
{
for(int i = 0; i < attributes.getLength(); i++)
{
if(attributes.getQName(i).equals("name")) this.name = attributes.getValue(i);
if(attributes.getQName(i).equals("type")) this.type = attributes.getValue(i);
}
}
public void end(String namespace, String name)
{
HashMap mapping = (HashMap)digester.peek(0);
if(this.name != null)
{
if(this.type == null)
System.out.println("WARNING: attribute '" + this.name + "' without type in schema " + (String)mapping.get("Schema_Name"));
else
{
if(this.type.startsWith("xsd:"))
this.type = this.type.substring(this.type.indexOf("xsd:")+4); // simplify the type name
mapping.put(this.name, this.type);
}
}
this.name = null;
this.type = null;
}
private String name;
private String type;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -