📄 abstractxmlparser.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: AbstractXmlParser.java
package org.kxml.parser;
import java.io.IOException;
import java.util.Vector;
import org.kxml.io.ParseException;
// Referenced classes of package org.kxml.parser:
// StartTag, ParseEvent
public abstract class AbstractXmlParser
{
protected boolean processNamespaces;
public AbstractXmlParser()
{
processNamespaces = true;
}
public void ignoreTree()
throws IOException
{
readTree(null);
}
public void readTree(Vector buf)
throws IOException
{
StartTag start = (StartTag)read();
do
{
ParseEvent event = peek();
if (buf != null)
buf.addElement(event);
switch (event.getType())
{
case 64: // '@'
readTree(buf);
break;
case 8: // '\b'
case 16: // '\020'
read();
return;
default:
read();
break;
}
} while (true);
}
public int getLineNumber()
throws IOException
{
return peek().getLineNumber();
}
public abstract ParseEvent read()
throws IOException;
public ParseEvent read(int type, String namespace, String name)
throws IOException
{
if (peek(type, namespace, name))
return read();
else
throw new ParseException("unexpected: " + peek(), null, peek().getLineNumber(), -1);
}
public boolean peek(int type, String namespace, String name)
throws IOException
{
ParseEvent pe = peek();
return pe.getType() == type && (namespace == null || namespace.equals(pe.getNamespace())) && (name == null || name.equals(pe.getName()));
}
public void skip()
throws IOException
{
do
{
int type = peek().type;
if (type == 1 || type == 2 || type == 32 || type == 256)
read();
else
return;
} while (true);
}
public abstract ParseEvent peek()
throws IOException;
public void setProcessNamespaces(boolean processNamespaces)
{
this.processNamespaces = processNamespaces;
}
public String readText()
throws IOException
{
StringBuffer buf = new StringBuffer();
do
{
ParseEvent event = peek();
switch (event.getType())
{
case 2: // '\002'
case 8: // '\b'
case 64: // '@'
throw new RuntimeException("Illegal event: " + event);
case 128:
case 256:
read();
buf.append(event.getText());
break;
case 16: // '\020'
return buf.toString();
default:
read();
break;
}
} while (true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -