⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 document.java

📁 Mofire的JAR压缩包
💻 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:   Document.java

package org.kxml.kdom;

import java.io.IOException;
import org.kxml.parser.AbstractXmlParser;
import org.kxml.parser.ParseEvent;

// Referenced classes of package org.kxml.kdom:
//			Node, Element

public class Document extends Node
{

	protected int rootIndex;

	public Document()
	{
		rootIndex = -1;
	}

	public String getName()
	{
		return "#document";
	}

	public void addChild(int index, int type, Object child)
	{
		if (type == 4)
		{
			if (rootIndex != -1)
				throw new RuntimeException("Only one document root element allowed");
			rootIndex = index;
		} else
		if (rootIndex >= index)
			rootIndex++;
		super.addChild(index, type, child);
	}

	public void parse(AbstractXmlParser parser)
		throws IOException
	{
		super.parse(parser);
		if (parser.read().getType() != 8)
			throw new RuntimeException("Document end expected!");
		else
			return;
	}

	public void removeChild(int index)
	{
		if (index == rootIndex)
			rootIndex = -1;
		else
		if (index < rootIndex)
			rootIndex--;
		super.removeChild(index);
	}

	public Element getRootElement()
	{
		if (rootIndex == -1)
			throw new RuntimeException("Document has no root element!");
		else
			return (Element)getChild(rootIndex);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -