org.backsource.utils.ant
Class XMLCatalogSystemIdAdapter

java.lang.Object
  extended byorg.backsource.utils.ant.XMLCatalogSystemIdAdapter
All Implemented Interfaces:
org.xml.sax.EntityResolver, javax.xml.transform.URIResolver

public class XMLCatalogSystemIdAdapter
extends java.lang.Object
implements org.xml.sax.EntityResolver, javax.xml.transform.URIResolver

Adapts the ant XMLCatalog, so that it is possible to lookup also systemid.

The current implementation of XMLCatalog only handles public id for dtd:s and enitiys. Often it is necesarry to be able to also look up a systemId at another location than the one specifyed, for example when only SYSTEM is specifyed in an XML file. eq <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">.

by specifying the last part of the systemid in the XMLCatalog data it is possible to lookup a systemid at another location than the one normaly resolved. for example, the following catalog definition would resolv the above SYSTEM to the log4j.jar file. *

 <xmlcatalog id="jbosscatalog">
   <classpath>
     <pathelement location="${lib.dir}/log4j.jar"/>
   </classpath>
   <entity
                   publicId="log4j.dtd"
                   location="org/apache/log4j/xml/log4j.dtd"/>
 
  </xmlcatalog>
 

Remember that this class is only possible to use from custom ant targets/helper classes.

Version:
$Revision: 1.1.1.1 $
Author:
Peter Antman

Field Summary
protected  org.apache.tools.ant.types.XMLCatalog catalog
           
 
Constructor Summary
XMLCatalogSystemIdAdapter()
           
XMLCatalogSystemIdAdapter(org.apache.tools.ant.types.XMLCatalog catalog)
           
 
Method Summary
 javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base)
          Does nothing currently.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          if publicId is null, translate systemId to a publicId thingy and call the real catalog.
 void setXMLCatalog(org.apache.tools.ant.types.XMLCatalog catalog)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

catalog

protected org.apache.tools.ant.types.XMLCatalog catalog
Constructor Detail

XMLCatalogSystemIdAdapter

public XMLCatalogSystemIdAdapter()

XMLCatalogSystemIdAdapter

public XMLCatalogSystemIdAdapter(org.apache.tools.ant.types.XMLCatalog catalog)
Parameters:
catalog - the XMLCatalog to delegate to.
Method Detail

setXMLCatalog

public void setXMLCatalog(org.apache.tools.ant.types.XMLCatalog catalog)

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
if publicId is null, translate systemId to a publicId thingy and call the real catalog.

Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
org.xml.sax.SAXException
java.io.IOException

resolve

public javax.xml.transform.Source resolve(java.lang.String href,
                                          java.lang.String base)
                                   throws javax.xml.transform.TransformerException
Does nothing currently.

Specified by:
resolve in interface javax.xml.transform.URIResolver
Throws:
javax.xml.transform.TransformerException


Copyright © 2000-2004 Backsource. All Rights Reserved.