congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
XMLCatalog
Code IndexAdd Tabnine to your IDE (free)

How to use
XMLCatalog
in
org.apache.tools.ant.types

Best Java code snippets using org.apache.tools.ant.types.XMLCatalog (Showing top 20 results out of 315)

origin: org.apache.ant/ant

/**
 * Add the catalog to our internal catalog
 *
 * @param xmlCatalog the XMLCatalog instance to use to look up DTDs
 */
public void addConfiguredXMLCatalog(final XMLCatalog xmlCatalog) {
  this.xmlCatalog.addConfiguredXMLCatalog(xmlCatalog);
}
origin: org.apache.ant/ant

/**
 * Get the XML catalog containing entity definitions
 *
 * @return the XML catalog for the task.
 */
public XMLCatalog getXMLCatalog() {
  xmlCatalog.setProject(getProject());
  return xmlCatalog;
}
origin: org.apache.ant/ant

/**
 * Creates the nested <code>&lt;entity&gt;</code> element.    Not
 * allowed if this catalog is itself a reference to another
 * catalog -- that is, a catalog cannot both refer to another
 * <em>and</em> contain elements or other attributes.
 *
 * @param entity the information about the URI resource mapping to be
 *       added to the catalog.
 * @exception BuildException if this is a reference and no nested
 *       elements are allowed.
 */
public void addEntity(ResourceLocation entity) throws BuildException {
  addDTD(entity);
}
origin: org.apache.ant/ant

/**
 * Implements the EntityResolver.resolveEntity() interface method.
 * @param publicId the public id to resolve.
 * @param systemId the system id to resolve.
 * @throws SAXException if there is a parsing problem.
 * @throws IOException if there is an IO problem.
 * @return the resolved entity.
 * @see org.xml.sax.EntityResolver#resolveEntity
 */
@Override
public InputSource resolveEntity(String publicId, String systemId)
  throws SAXException, IOException {
  if (isReference()) {
    return getRef().resolveEntity(publicId, systemId);
  }
  dieOnCircularReference();
  log("resolveEntity: '" + publicId + "': '" + systemId + "'",
    Project.MSG_DEBUG);
  InputSource inputSource =
    getCatalogResolver().resolveEntity(publicId, systemId);
  if (inputSource == null) {
    log("No matching catalog entry found, parser will use: '"
      + systemId + "'", Project.MSG_DEBUG);
  }
  return inputSource;
}
origin: org.andromda.thirdparty.jaxb2_commons/jaxb-xjc

/**
 * Add the catalog to our internal catalog
 *
 * @param xmlCatalog the XMLCatalog instance to use to look up DTDs
 */
public void addConfiguredXMLCatalog(XMLCatalog xmlCatalog) {
  if(this.xmlCatalog==null) {
    this.xmlCatalog = new XMLCatalog();
    this.xmlCatalog.setProject(getProject());
  }
  this.xmlCatalog.addConfiguredXMLCatalog(xmlCatalog);
}
origin: org.wso2.wsdl.validator/wsdl-validator

/**
 * Allow specification of a DTD outside of an XMLCatalog.
 * 
 * @return a DTDLocation with the specified DTD
 **/
public DTDLocation createDTD()
{
 DTDLocation dtdLoc = new DTDLocation();
 globalXMLCatalog.addEntity(dtdLoc);
 return dtdLoc;
}

origin: org.wso2.wsdl.validator/wsdl-validator

/**
 * @see org.eclipse.wst.wsdl.validation.internal.xml.XMLCatalog#resolveEntityLocation(java.lang.String, java.lang.String)
 */
public String resolveEntityLocation(String publicId, String systemId)
{
 String resolvedId = null;
 try
 {
  InputSource is = xmlCatalog.resolveEntity(publicId, systemId);
  if (is != null)
  {
   resolvedId = is.getSystemId();
  }
 }
 // 
 catch (Exception e)
 {
  // Do nothing if the resource can't be resolved.
 }
 // needs to return null if it can't resolve the id
 if (resolvedId != null && resolvedId.equals(""))
 {
  resolvedId = null;
 }
 return resolvedId;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

/**
 * Add the catalog to our internal catalog
 *
 * @param xmlCatalog the XMLCatalog instance to use to look up DTDs
 */
public void addConfiguredXMLCatalog(XMLCatalog xmlCatalog) {
  if (this.xmlCatalog == null) {
    this.xmlCatalog = new XMLCatalog();
    this.xmlCatalog.setProject(getProject());
  }
  this.xmlCatalog.addConfiguredXMLCatalog(xmlCatalog);
}
origin: org.wso2.wsdl.validator/wsdl-validator

/**
 * Allow specification of an entity outside of an XMLCatalog.
 * 
 * @return a DTDLocation with the specified entity
 **/
public DTDLocation createEntity()
{
 DTDLocation dtdLoc = new DTDLocation();
 globalXMLCatalog.addEntity(dtdLoc);
 return dtdLoc;
}
origin: org.glassfish.metro/webservices-tools

public void addConfiguredXMLCatalog(XMLCatalog entityResolver) {
  if(this.xmlCatalog==null){
    this.xmlCatalog = new XMLCatalog();
    xmlCatalog.setProject(getProject());
  }
  this.xmlCatalog.addConfiguredXMLCatalog(entityResolver);
}
origin: org.apache.ant/ant

/**
 * add an XMLCatalog as a nested element; optional.
 * @param catalog the XMLCatalog to use
 */
public void addConfiguredXMLCatalog(XMLCatalog catalog) {
  xmlCatalog.addConfiguredXMLCatalog(catalog);
}
origin: org.apache.ant/ant

/**
 * Initializes the task.
 */
@Override
public void init() {
  super.init();
  xmlCatalog.setProject(getProject());
}
origin: org.apache.ant/ant

/**
 * Create a DTD location record; optional.
 * This stores the location of a DTD. The DTD is identified
 * by its public Id.
 * @return created DTD location
 */
public DTDLocation createDTD() {
  DTDLocation dtdLocation = new DTDLocation();
  xmlCatalog.addDTD(dtdLocation);
  return dtdLocation;
}
/**
origin: org.wso2.wsdl.validator/wsdl-validator

/**
 * @see org.eclipse.wst.wsdl.validation.internal.xml.XMLCatalog#addEntryToCatalog(java.lang.String, java.lang.String)
 */
public void addEntryToCatalog(String publicId, String systemId)
{
 DTDLocation resLoc = new DTDLocation();
 resLoc.setLocation(systemId);
 resLoc.setPublicId(publicId);
 xmlCatalog.addEntity(resLoc);
}
origin: sun-jaxb/jaxb-xjc

/**
 * Add the catalog to our internal catalog
 *
 * @param xmlCatalog the XMLCatalog instance to use to look up DTDs
 */
public void addConfiguredXMLCatalog(XMLCatalog xmlCatalog) {
  if(this.xmlCatalog==null) {
    this.xmlCatalog = new XMLCatalog();
    this.xmlCatalog.setProject(getProject());
  }
  this.xmlCatalog.addConfiguredXMLCatalog(xmlCatalog);
}
origin: org.apache.ant/ant

/**
 * add an XMLCatalog as a nested element; optional.
 * @param catalog XMLCatalog to use
 */
public void addConfiguredXMLCatalog(XMLCatalog catalog) {
  xmlCatalog.addConfiguredXMLCatalog(catalog);
}
origin: org.apache.ant/ant

/**
 * Called by the project to let the task initialize properly.
 *
 * @exception BuildException if something goes wrong with the build
 */
public void init() throws BuildException {
  super.init();
  xmlCatalog.setProject(getProject());
}
origin: org.apache.ant/ant-apache-resolver

/**
 * <p>Add a PUBLIC catalog entry to the controlling XMLCatalog instance.
 * ApacheCatalog calls this for each PUBLIC entry found in an external
 * catalog file.</p>
 *
 * @param publicid The public ID of the resource
 * @param systemid The system ID (aka location) of the resource
 * @param base The base URL of the resource.  If the systemid
 * specifies a relative URL/pathname, it is resolved using the
 * base.  The default base for an external catalog file is the
 * directory in which the catalog is located.
 *
 */
public void addPublicEntry(final String publicid,
              final String systemid,
              final URL base) {
  final ResourceLocation dtd = new ResourceLocation();
  dtd.setBase(base);
  dtd.setPublicId(publicid);
  dtd.setLocation(systemid);
  xmlCatalog.addDTD(dtd);
}
origin: org.apache.ant/ant-apache-resolver

/**
 * <p>Add a URI catalog entry to the controlling XMLCatalog instance.
 * ApacheCatalog calls this for each URI entry found in an external
 * catalog file.</p>
 *
 * @param uri The URI of the resource
 * @param altURI The URI to which the resource should be mapped
 * (aka the location)
 * @param base The base URL of the resource.  If the altURI
 * specifies a relative URL/pathname, it is resolved using the
 * base.  The default base for an external catalog file is the
 * directory in which the catalog is located.
 *
 */
public void addURIEntry(final String uri,
            final String altURI,
            final URL base) {
  final ResourceLocation entity = new ResourceLocation();
  entity.setBase(base);
  entity.setPublicId(uri);
  entity.setLocation(altURI);
  xmlCatalog.addEntity(entity);
}
origin: org.glassfish.metro/webservices-tools

/**
 * Add the catalog to our internal catalog
 *
 * @param xmlCatalog the XMLCatalog instance to use to look up DTDs
 */
public void addConfiguredXMLCatalog(XMLCatalog xmlCatalog) {
  if (this.xmlCatalog == null) {
    this.xmlCatalog = new XMLCatalog();
    this.xmlCatalog.setProject(getProject());
  }
  this.xmlCatalog.addConfiguredXMLCatalog(xmlCatalog);
}
org.apache.tools.ant.typesXMLCatalog

Javadoc

This data type provides a catalog of resource locations (such as DTDs and XML entities), based on the OASIS "Open Catalog" standard. The catalog entries are used both for Entity resolution and URI resolution, in accordance with the org.xml.sax.EntityResolver and javax.xml.transform.URIResolver interfaces as defined in the Java API for XML Processing Specification.

Resource locations can be specified either in-line or in external catalog file(s), or both. In order to use an external catalog file, the xml-commons resolver library ("resolver.jar") must be in your classpath. External catalog files may be either plain text format or XML format. If the xml-commons resolver library is not found in the classpath, external catalog files, specified in <catalogpath> paths, will be ignored and a warning will be logged. In this case, however, processing of inline entries will proceed normally.

Currently, only <dtd> and <entity> elements may be specified inline; these correspond to OASIS catalog entry types PUBLIC and URI respectively.

The following is a usage example:

 
<xmlcatalog> 
<dtd publicId="" location="/path/to/file.jar"/> 
<dtd publicId="" location="/path/to/file2.jar"/> 
<entity publicId="" location="/path/to/file3.jar"/> 
<entity publicId="" location="/path/to/file4.jar"/> 
<catalogpath> 
<pathelement location="/etc/sgml/catalog"/> 
</catalogpath> 
<catalogfiles dir="/opt/catalogs/" includes="**\catalog.xml"/> 
</xmlcatalog> 

Tasks wishing to use <xmlcatalog> must provide a method called createXMLCatalog which returns an instance of XMLCatalog. Nested DTD and entity definitions are handled by the XMLCatalog object and must be labeled dtd and entity respectively.

The following is a description of the resolution algorithm: entities/URIs/dtds are looked up in each of the following contexts, stopping when a valid and readable resource is found:

  1. In the local filesystem
  2. In the classpath
  3. Using the Apache xml-commons resolver (if it is available)
  4. In URL-space

See org.apache.tools.ant.taskdefs.optional.XMLValidateTask for an example of a task that has integrated support for XMLCatalogs.

Possible future extension could provide for additional OASIS entry types to be specified inline.

Most used methods

  • addConfiguredXMLCatalog
    Loads a nested into our definition. Not allowed if this catalog is itself a reference t
  • setProject
  • <init>
    Default constructor
  • addDTD
    Creates the nested element. Not allowed if this catalog is itself a reference to another catal
  • addEntity
    Creates the nested element. Not allowed if this catalog is itself a reference to another ca
  • resolveEntity
    Implements the EntityResolver.resolveEntity() interface method.
  • createCatalogPath
    Creates a nested element. Not allowed if this catalog is itself a reference to another
  • createClasspath
    Allows nested classpath elements. Not allowed if this catalog is itself a reference to another catal
  • dieOnCircularReference
  • getCatalogPath
    Returns the catalog path in which to attempt to resolve DTDs.
  • getCatalogResolver
    Factory method for creating the appropriate CatalogResolver strategy implementation.Until we query t
  • getCheckedRef
  • getCatalogResolver,
  • getCheckedRef,
  • getClasspath,
  • getElements,
  • getProject,
  • getRef,
  • isChecked,
  • isReference,
  • log,
  • noChildrenAllowed

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • putExtra (Intent)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Table (org.hibernate.mapping)
    A relational table
  • Option (scala)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now