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

📄 starttag.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:   StartTag.java

package org.kxml.parser;

import java.util.Vector;
import org.kxml.Attribute;
import org.kxml.PrefixMap;

// Referenced classes of package org.kxml.parser:
//			Tag, ParseEvent

public class StartTag extends Tag
{

	Vector attributes;
	boolean degenerated;
	PrefixMap prefixMap;

	public StartTag(StartTag parent, String namespace, String name, Vector attributes, boolean degenerated, boolean processNamespaces)
	{
		super(64, parent, namespace, name);
		this.attributes = attributes != null && attributes.size() != 0 ? attributes : null;
		this.degenerated = degenerated;
		prefixMap = parent != null ? parent.prefixMap : PrefixMap.DEFAULT;
		if (!processNamespaces)
			return;
		boolean any = false;
		for (int i = getAttributeCount() - 1; i >= 0; i--)
		{
			Attribute attr = (Attribute)attributes.elementAt(i);
			String attrName = attr.getName();
			int cut = attrName.indexOf(':');
			String prefix;
			if (cut != -1)
			{
				prefix = attrName.substring(0, cut);
				attrName = attrName.substring(cut + 1);
			} else
			{
				if (!attrName.equals("xmlns"))
					continue;
				prefix = attrName;
				attrName = "";
			}
			if (!prefix.equals("xmlns"))
			{
				if (!prefix.equals("xml"))
					any = true;
			} else
			{
				prefixMap = new PrefixMap(prefixMap, attrName, attr.getValue());
				attributes.removeElementAt(i);
			}
		}

		int len = getAttributeCount();
		if (any)
		{
			for (int i = 0; i < len; i++)
			{
				Attribute attr = (Attribute)attributes.elementAt(i);
				String attrName = attr.getName();
				int cut = attrName.indexOf(':');
				if (cut == 0)
					throw new RuntimeException("illegal attribute name: " + attrName + " at " + this);
				if (cut != -1)
				{
					String attrPrefix = attrName.substring(0, cut);
					if (!attrPrefix.equals("xml"))
					{
						attrName = attrName.substring(cut + 1);
						String attrNs = prefixMap.getNamespace(attrPrefix);
						if (attrNs == null)
							throw new RuntimeException("Undefined Prefix: " + attrPrefix + " in " + this);
						attributes.setElementAt(new Attribute(attrNs, attrName, attr.getValue()), i);
					}
				}
			}

		}
		int cut = name.indexOf(':');
		String prefix;
		if (cut == -1)
		{
			prefix = "";
		} else
		{
			if (cut == 0)
				throw new RuntimeException("illegal tag name: " + name + " at " + this);
			prefix = name.substring(0, cut);
			super.name = name.substring(cut + 1);
		}
		super.namespace = prefixMap.getNamespace(prefix);
		if (super.namespace == null)
		{
			if (prefix.length() != 0)
				throw new RuntimeException("undefined prefix: " + prefix + " in " + prefixMap + " at " + this);
			super.namespace = "";
		}
	}

	public Vector getAttributes()
	{
		return attributes;
	}

	public boolean getDegenerated()
	{
		return degenerated;
	}

	public PrefixMap getPrefixMap()
	{
		return prefixMap;
	}

	public String toString()
	{
		return "StartTag <" + super.name + "> line: " + super.lineNumber + " attr: " + attributes;
	}

	public void setPrefixMap(PrefixMap map)
	{
		prefixMap = map;
	}
}

⌨️ 快捷键说明

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