|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.xml.catalog.impl.oasis; import java.util.*; import org.xml.sax.*; /** * Partial implementation of OASIS catalog. * * @author Petr Kuzel * @version generated by FFJ XML module */ class CatalogHandlerImpl implements CatalogHandler { private static final String XML_BASE_ATT = "xml:base"; // NOI18N private static final String CATALOG_ATT = "catalog"; // NOI18N private static final String PUBLIC_ID_ATT = "publicId"; // NOI18N private static final String URI_ATT = "uri"; // NOI18N private static final String SYSTEM_ID_ATT = "systemId"; // NOI18N private static final String PREFER_ATT = "prefer"; // NOI18N private static final String NAME_ATT = "name"; // NOI18N private Stack groups = new Stack(); private Catalog target; public CatalogHandlerImpl(Catalog target) { this.target = target; } public void handle_system(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_system: " + meta); // NOI18N String systemId = meta.getValue(SYSTEM_ID_ATT); String uri = meta.getValue(URI_ATT); target.addSystemMapping(systemId, resolve(uri)); } public void handle_uri(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_uri: " + meta); // NOI18N String name = meta.getValue(NAME_ATT); String uri = meta.getValue(URI_ATT); //!!! } public void handle_public(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_public: " + meta); // NOI18N String publicId = meta.getValue(PUBLIC_ID_ATT); String uri = meta.getValue(URI_ATT); target.addPublicMapping(publicId, resolve(uri)); } public void handle_rewriteSystem(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_rewriteSystem: " + meta); // NOI18N } public void handle_delegateSystem(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_delegateSystem: " + meta); // NOI18N } public void start_catalog(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("start_catalog: " + meta); // NOI18N String base = meta.getValue(XML_BASE_ATT); String prefer = meta.getValue(PREFER_ATT); groups.push(new Group(base, "public".equals(prefer))); // NOI18N } public void end_catalog() throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("end_catalog()"); // NOI18N groups.pop(); } public void handle_rewriteURI(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_rewriteURI: " + meta); // NOI18N } public void handle_delegatePublic(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_delegatePublic: " + meta); // NOI18N } public void handle_nextCatalog(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_nextCatalog: " + meta); // NOI18N } public void start_group(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("start_group: " + meta); // NOI18N String base = meta.getValue(XML_BASE_ATT); String prefer = meta.getValue(PREFER_ATT); groups.push(new Group(base, "public".equals(prefer))); // NOI18N } public void end_group() throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("end_group()"); // NOI18N groups.pop(); } public void handle_delegateURI(final AttributeList meta) throws SAXException { if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("handle_delegateURI: " + meta); // NOI18N } /* * Conver local URIs according to current base */ private String resolve(String uri) { if (uri == null) return null; if (currentBase() == null) return uri; return uri; //!!! not implemented } private String currentBase() { return ((Group)groups.peek()).base; } private boolean currentPreference() { return ((Group)groups.peek()).prefer; } private class Group { String base; boolean prefer; Group(String base, boolean prefer) { this.base = base; this.prefer = prefer; } } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.