Package org.apache.xml.resolver

Examples of org.apache.xml.resolver.Catalog


       
        CatalogManager catalogManager = new CatalogManager();
        catalogManager.setUseStaticCatalog(false);
        catalogManager.setIgnoreMissingProperties(true);
        CatalogResolver catalogResolver = new CatalogResolver(catalogManager);
        Catalog catalog = catalogResolver.getCatalog();
       
        if (catalogURI != null) {
            LOG.debug("Found OASIS catalog {} ", catalogURI);
            try {
                catalog.parseCatalog(catalogURI);
            } catch (Exception e) {
                LOG.warn("Failed to read OASIS catalog", e);
            }
        }
       
View Full Code Here


    static Catalog buildPrivateCatalog(URL catalogLocation) {
        CatalogManager catalogManager = new CatalogManager();
        catalogManager.setUseStaticCatalog(false);
        catalogManager.setVerbosity(0);
        catalogManager.setIgnoreMissingProperties(true);
        Catalog catalog = catalogManager.getCatalog();
        try {
            catalog.parseCatalog(catalogLocation);
        } catch (IOException e) {
            throw new RuntimeException("Error trying to load OASIS catalog from URL "
                    + catalogLocation.toString(), e);
        }
        return catalog;
View Full Code Here

     * XMLCatalog calls this to add an external catalog file for each
     * file within a <code>&lt;catalogfiles&gt;</code> fileset.
     */
    public void parseCatalog(String file) {

        Catalog _catalog = getCatalog();
        if (!(_catalog instanceof ApacheCatalog)) {
            throw new BuildException("Wrong catalog type found: " + _catalog.getClass().getName());
        }
        ApacheCatalog catalog = (ApacheCatalog) _catalog;

        // Pass in reference to ourselves so we can be called back.
        catalog.setResolver(this);
View Full Code Here

     * parsed immediately. The others will be queued and read if
     * they are needed later.
     */
    private void parseCatalogs () throws IOException {
        if (fCatalogsList != null) {
            fCatalog = new Catalog(fResolverCatalogManager);
            attachReaderToCatalog(fCatalog);
            for (int i = 0; i < fCatalogsList.length; ++i) {
                String catalog = fCatalogsList[i];
                if (catalog != null && catalog.length() > 0) {
                    fCatalog.parseCatalog(catalog);
View Full Code Here

  private void parseCatalogs()
    throws IOException
  {
    if (this.fCatalogsList != null)
    {
      this.fCatalog = new Catalog(this.fResolverCatalogManager);
      attachReaderToCatalog(this.fCatalog);
      for (int i = 0; i < this.fCatalogsList.length; i++)
      {
        String str = this.fCatalogsList[i];
        if ((str == null) || (str.length() <= 0))
View Full Code Here

/*     */         }
/*     */       }
/*     */     }
/*     */
/* 218 */     CatalogResolver catalogResolver = new CatalogResolver();
/* 219 */     Catalog resolver = catalogResolver.getCatalog();
/*     */
/* 221 */     for (int count = 0; count < catalogFiles.size(); count++) {
/* 222 */       String file = (String)catalogFiles.elementAt(count);
/* 223 */       resolver.parseCatalog(file);
/*     */     }
/* 225 */     String result = null;
/*     */
/* 227 */     if (resType == Catalog.DOCTYPE) {
/* 228 */       System.out.println("Resolve DOCTYPE (name, publicid, systemid):");
/* 229 */       if (name != null) System.out.println("       name: " + name);
/* 230 */       if (publicId != null) System.out.println("  public id: " + publicId);
/* 231 */       if (systemId != null) System.out.println("  system id: " + systemId);
/* 232 */       if (uri != null) System.out.println("        uri: " + uri);
/* 233 */       result = resolver.resolveDoctype(name, publicId, systemId);
/* 234 */     } else if (resType == Catalog.DOCUMENT) {
/* 235 */       System.out.println("Resolve DOCUMENT ():");
/* 236 */       result = resolver.resolveDocument();
/* 237 */     } else if (resType == Catalog.ENTITY) {
/* 238 */       System.out.println("Resolve ENTITY (name, publicid, systemid):");
/* 239 */       if (name != null) System.out.println("       name: " + name);
/* 240 */       if (publicId != null) System.out.println("  public id: " + publicId);
/* 241 */       if (systemId != null) System.out.println("  system id: " + systemId);
/* 242 */       result = resolver.resolveEntity(name, publicId, systemId);
/* 243 */     } else if (resType == Catalog.NOTATION) {
/* 244 */       System.out.println("Resolve NOTATION (name, publicid, systemid):");
/* 245 */       if (name != null) System.out.println("       name: " + name);
/* 246 */       if (publicId != null) System.out.println("  public id: " + publicId);
/* 247 */       if (systemId != null) System.out.println("  system id: " + systemId);
/* 248 */       result = resolver.resolveNotation(name, publicId, systemId);
/* 249 */     } else if (resType == Catalog.PUBLIC) {
/* 250 */       System.out.println("Resolve PUBLIC (publicid, systemid):");
/* 251 */       if (publicId != null) System.out.println("  public id: " + publicId);
/* 252 */       if (systemId != null) System.out.println("  system id: " + systemId);
/* 253 */       result = resolver.resolvePublic(publicId, systemId);
/* 254 */     } else if (resType == Catalog.SYSTEM) {
/* 255 */       System.out.println("Resolve SYSTEM (systemid):");
/* 256 */       if (systemId != null) System.out.println("  system id: " + systemId);
/* 257 */       result = resolver.resolveSystem(systemId);
/* 258 */     } else if (resType == Catalog.URI) {
/* 259 */       System.out.println("Resolve URI (uri):");
/* 260 */       if (uri != null) System.out.println("        uri: " + uri);
/* 261 */       result = resolver.resolveURI(uri);
/*     */     } else {
/* 263 */       System.out.println("resType is wrong!? This can't happen!");
/* 264 */       usage();
/*     */     }
/*     */
View Full Code Here

/*     */     }
/*     */
/* 159 */     ResolvingParser.validating = validating;
/* 160 */     ResolvingParser.namespaceAware = nsAware;
/* 161 */     ResolvingParser reader = new ResolvingParser();
/* 162 */     Catalog catalog = reader.getCatalog();
/*     */
/* 164 */     for (int count = 0; count < catalogFiles.size(); count++) {
/* 165 */       String file = (String)catalogFiles.elementAt(count);
/* 166 */       catalog.parseCatalog(file);
/*     */     }
/*     */
/* 169 */     XParseError xpe = new XParseError(showErrors, showWarnings);
/* 170 */     xpe.setMaxMessages(maxErrs);
/* 171 */     reader.setErrorHandler(xpe);
View Full Code Here

/*     */       }
/*     */     }
/*     */     catch (SAXException e)
/*     */     {
/*     */     }
/* 177 */     Catalog catalog = reader.getCatalog();
/*     */
/* 179 */     for (int count = 0; count < catalogFiles.size(); count++) {
/* 180 */       String file = (String)catalogFiles.elementAt(count);
/* 181 */       catalog.parseCatalog(file);
/*     */     }
/*     */
/* 184 */     XParseError xpe = new XParseError(showErrors, showWarnings);
/* 185 */     xpe.setMaxMessages(maxErrs);
/* 186 */     reader.setErrorHandler(xpe);
View Full Code Here

        return getTargetNode(resolvedLocation);
    }

    private String resolveByCatalog(String url) {
        Bus bus = (Bus)env.get(Bus.class);
        Catalog catalogResolver = OASISCatalogManager.getCatalogManager(bus).getCatalog();
        String resolvedLocation;
        try {
            resolvedLocation = catalogResolver.resolveSystem(url);
            if (resolvedLocation == null) {
                resolvedLocation = catalogResolver.resolveURI(url);
            }
        } catch (Exception e1) {
            Message msg = new Message("FAILED_RESOLVE_CATALOG", LOG, url);
            throw new ToolException(msg, e1);
        }
View Full Code Here

    }

    private Document getWSDLDoc(String wsdl) {
        LOG.log(Level.FINE, new Message("VALIDATE_WSDL", LOG, wsdl).toString());
        try {
            Catalog catalogResolver = OASISCatalogManager.getCatalogManager(this.getBus()).getCatalog();

            String nw = catalogResolver.resolveSystem(wsdl);
            if (nw == null) {
                nw = catalogResolver.resolveURI(wsdl);
            }
            if (nw == null) {
                nw = catalogResolver.resolvePublic(wsdl, null);
            }
            if (nw == null) {
                nw = wsdl;
            }
            return new Stax2DOM().getDocument(URIParserUtil.getAbsoluteURI(nw));
View Full Code Here

TOP

Related Classes of org.apache.xml.resolver.Catalog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.