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

📄 xcat.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
		bases = null;	    }	}	// XML Base support for external entities.	// NOTE: expects parser is in default "resolve-dtd-uris" mode.	public void externalEntityDecl (String name, String pub, String sys)	throws SAXException	{	    if (externals == null)		externals = new Hashtable ();	    if (externals.get (name) == null)		externals.put (name, pub);	}	public void startEntity (String name)	throws SAXException	{	    if (externals == null)		return;	    String uri = (String) externals.get (name);	    // NOTE: breaks if an EntityResolver substitutes these URIs.	    // If toplevel loader supports one, must intercept calls...	    if (uri != null) {		try {		    bases.push (new URL (uri));		} catch (IOException e) {		    fatal ("entity '" + name + "', bad URI: " + uri);		}	    }	}	public void endEntity (String name)	{	    if (externals == null)		return;	    String value = (String) externals.get (name);	    if (value != null)		bases.pop ();	}	/**	 * Processes catalog elements, saving their data.	 */	public void startElement (String namespace, String local,	    String qName, Attributes atts)	throws SAXException	{	    // must ignore non-catalog elements, and their contents	    if (ignoreDepth != 0 || !catalogNamespace.equals (namespace)) {		ignoreDepth++;		return;	    }	    // basic sanity checks	    if (!preInterned)		local = local.intern ();	    if (!started) {		started = true;		if ("catalog" != local)		    fatal ("root element not 'catalog': " + local);	    }	    // Handle any xml:base attribute	    String	xmlbase = atts.getValue ("xml:base");	    if (xmlbase != null) {		URL	base = (URL) bases.peek ();		try {		    base = new URL (base, xmlbase);		} catch (IOException e) {		    fatal ("can't resolve xml:base attribute: " + xmlbase);		}		bases.push (base);	    } else		bases.push (bases.peek ());	    // fetch multi-element attributes, apply standard tweaks	    // values (uri, catalog, rewritePrefix) get normalized too,	    // as a precaution and since we may compare the values	    String	catalog = atts.getValue ("catalog");	    if (catalog != null)		catalog = normalizeURI (absolutize (catalog));	    String	rewritePrefix = atts.getValue ("rewritePrefix");	    if (rewritePrefix != null)		rewritePrefix = normalizeURI (absolutize (rewritePrefix));	    String	systemIdStartString;	    systemIdStartString = atts.getValue ("systemIdStartString");	    if (systemIdStartString != null) {		systemIdStartString = normalizeURI (systemIdStartString);		// unmatchable <rewriteSystemId>, <delegateSystemId> elements		if (systemIdStartString.startsWith ("urn:publicid:")) {		    error ("systemIdStartString is really a publicId!!");		    return;		}	    }	    String	uri = atts.getValue ("uri");	    if (uri != null)		uri = normalizeURI (absolutize (uri));	    String	uriStartString;	    uriStartString = atts.getValue ("uriStartString");	    if (uriStartString != null) {		uriStartString = normalizeURI (uriStartString);		// unmatchable <rewriteURI>, <delegateURI> elements		if (uriStartString.startsWith ("urn:publicid:")) {		    error ("uriStartString is really a publicId!!");		    return;		}	    }	    // strictly speaking "group" and "catalog" shouldn't nest	    // ... arbitrary restriction, no evident motivation// FIXME stack "prefer" settings (two elements only!) and use// them to populate different public mapping/delegation tables	    if ("catalog" == local || "group" == local) {		String	prefer = atts.getValue ("prefer");		if (prefer != null && !"public".equals (prefer)) {		    if (!"system".equals (prefer)) {			error ("in <" + local + " ... prefer='...'>, "			    + "assuming 'public'");			prefer = "public";		    }		}		if (prefer != null) {		    if ("catalog" == local) {			cat.hasPreference = true;			cat.usingPublic = "public".equals (prefer);		    } else {			if (!cat.hasPreference || cat.usingPublic				    != "public".equals (prefer)) {fatal ("<group prefer=...> case not handled");			}		    }		} else if ("group" == local && cat.hasPreference) {fatal ("<group prefer=...> case not handled");		}	    //	    // PUBLIC ids:  cleanly set up for id substitution	    //	    } else if ("public" == local) {		String	publicId = atts.getValue ("publicId");		String	value = null;		if (publicId == null || uri == null) {		    error ("expecting <public publicId=... uri=.../>");		    return;		}		publicId = normalizePublicId (true, publicId);		uri = nofrag (uri);		if (cat.publicIds == null)		    cat.publicIds = new Hashtable ();		else		    value = (String) cat.publicIds.get (publicId);		if (value != null) {		    if (!value.equals (uri))			warn ("ignoring <public...> entry for " + publicId);		} else		    cat.publicIds.put (publicId, uri);	    } else if ("delegatePublic" == local) {		String	publicIdStartString;		Object	value = null;		publicIdStartString = atts.getValue ("publicIdStartString");		if (publicIdStartString == null || catalog == null) {		    error ("expecting <delegatePublic "			+ "publicIdStartString=... catalog=.../>");		    return;		}		publicIdStartString = normalizePublicId (true,			publicIdStartString);		if (cat.publicDelegations == null)		    cat.publicDelegations = new Hashtable ();		else		    value = cat.publicDelegations.get (publicIdStartString);		if (value != null) {		    if (!value.equals (catalog))			warn ("ignoring <delegatePublic...> entry for "			    + uriStartString);		} else		    cat.publicDelegations.put (publicIdStartString, catalog);	    //	    // SYSTEM ids:  need substitution due to operational issues	    //	    } else if ("system" == local) {		String	systemId = atts.getValue ("systemId");		String	value = null;		if (systemId == null || uri == null) {		    error ("expecting <system systemId=... uri=.../>");		    return;		}		systemId = normalizeURI (systemId);		uri = nofrag (uri);		if (systemId.startsWith ("urn:publicid:")) {		    error ("systemId is really a publicId!!");		    return;		}		if (cat.systemIds == null) {		    cat.systemIds = new Hashtable ();		    if (unified)			cat.uris = cat.systemIds;		} else		    value = (String) cat.systemIds.get (systemId);		if (value != null) {		    if (!value.equals (uri))			warn ("ignoring <system...> entry for " + systemId);		} else		    cat.systemIds.put (systemId, uri);	    } else if ("rewriteSystem" == local) {		String	value = null;		if (systemIdStartString == null || rewritePrefix == null			|| systemIdStartString.length () == 0			|| rewritePrefix.length () == 0			) {		    error ("expecting <rewriteSystem "			+ "systemIdStartString=... rewritePrefix=.../>");		    return;		}		if (cat.systemRewrites == null) {		    cat.systemRewrites = new Hashtable ();		    if (unified)			cat.uriRewrites = cat.systemRewrites;		} else		    value = (String) cat.systemRewrites.get (		    				systemIdStartString);		if (value != null) {		    if (!value.equals (rewritePrefix))			warn ("ignoring <rewriteSystem...> entry for "			    + systemIdStartString);		} else		    cat.systemRewrites.put (systemIdStartString,		    		rewritePrefix);	    } else if ("delegateSystem" == local) {		Object	value = null;		if (systemIdStartString == null || catalog == null) {		    error ("expecting <delegateSystem "			+ "systemIdStartString=... catalog=.../>");		    return;		}		if (cat.systemDelegations == null) {		    cat.systemDelegations = new Hashtable ();		    if (unified)			cat.uriDelegations = cat.systemDelegations;		} else		    value = cat.systemDelegations.get (systemIdStartString);		if (value != null) {		    if (!value.equals (catalog))			warn ("ignoring <delegateSystem...> entry for "			    + uriStartString);		} else		    cat.systemDelegations.put (systemIdStartString, catalog);	    //	    // URI:  just like "system" ID support, except that	    // fragment IDs are disallowed in "system" elements.	    //	    } else if ("uri" == local) {		String	name = atts.getValue ("name");		String	value = null;		if (name == null || uri == null) {		    error ("expecting <uri name=... uri=.../>");		    return;		}		if (name.startsWith ("urn:publicid:")) {		    error ("name is really a publicId!!");		    return;		}		name = normalizeURI (name);		if (cat.uris == null) {		    cat.uris = new Hashtable ();		    if (unified)			cat.systemIds = cat.uris;		} else		    value = (String) cat.uris.get (name);		if (value != null) {		    if (!value.equals (uri))			warn ("ignoring <uri...> entry for " + name);		} else		    cat.uris.put (name, uri);	    } else if ("rewriteURI" == local) {		String value = null;		if (uriStartString == null || rewritePrefix == null			|| uriStartString.length () == 0			|| rewritePrefix.length () == 0			) {		    error ("expecting <rewriteURI "			+ "uriStartString=... rewritePrefix=.../>");		    return;		}		if (cat.uriRewrites == null) {		    cat.uriRewrites = new Hashtable ();		    if (unified)			cat.systemRewrites = cat.uriRewrites;		} else		    value = (String) cat.uriRewrites.get (uriStartString);		if (value != null) {		    if (!value.equals (rewritePrefix))			warn ("ignoring <rewriteURI...> entry for "			    + uriStartString);		} else		    cat.uriRewrites.put (uriStartString, rewritePrefix);	    } else if ("delegateURI" == local) {		Object	value = null;		if (uriStartString == null || catalog == null) {		    error ("expecting <delegateURI "			+ "uriStartString=... catalog=.../>");		    return;		}		if (cat.uriDelegations == null) {		    cat.uriDelegations = new Hashtable ();		    if (unified)			cat.systemDelegations = cat.uriDelegations;		} else		    value = cat.uriDelegations.get (uriStartString);		if (value != null) {		    if (!value.equals (catalog))			warn ("ignoring <delegateURI...> entry for "			    + uriStartString);		} else		    cat.uriDelegations.put (uriStartString, catalog);	    //	    // NON-DELEGATING approach to modularity	    //	    } else if ("nextCatalog" == local) {		if (catalog == null) {		    error ("expecting <nextCatalog catalog=.../>");		    return;		}		if (cat.next == null)		    cat.next = new Vector ();		cat.next.addElement (catalog);	    //	    // EXTENSIONS from appendix E	    //	    } else if ("doctype" == local) {		String	name = atts.getValue ("name");		String	value = null;		if (name == null || uri == null) {		    error ("expecting <doctype name=... uri=.../>");		    return;		}		name = normalizeURI (name);		if (cat.doctypes == null)		    cat.doctypes = new Hashtable ();		else		    value = (String) cat.doctypes.get (name);		if (value != null) {		    if (!value.equals (uri))			warn ("ignoring <doctype...> entry for "			    + uriStartString);		} else		    cat.doctypes.put (name, uri);	    	    //	    // RESERVED ... ignore (like reserved attributes) but warn	    //	    } else {		warn ("ignoring unknown catalog element: " + local);		ignoreDepth++;	    }	}	public void endElement (String uri, String local, String qName)	throws SAXException	{	    if (ignoreDepth != 0)		ignoreDepth--;	    else		bases.pop ();	}    }}

⌨️ 快捷键说明

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