Package org.apache.xml.resolver

Examples of org.apache.xml.resolver.CatalogEntry


    /**
     * Adds a new Entry to the catalog
     */
    private void addEntry(String type, Vector args) {
        try {
            CatalogEntry entry = new CatalogEntry(type, args);
            catalog.addEntry(entry);
        } catch (CatalogException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here


    /**
     * Adds a new Entry to the catalog
     */
    private void addEntry(String type, Vector args) {
        try {
            CatalogEntry entry = new CatalogEntry(type, args);
            catalog.addEntry(entry);
        } catch (CatalogException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

/* 161 */         this.baseURIStack.push(baseURI);
/*     */
/* 163 */         this.debug.message(4, "xml:base", baseURI);
/*     */         try
/*     */         {
/* 166 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 167 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/* 169 */           if (cex.getExceptionType() == 3)
/* 170 */             this.debug.message(1, "Invalid catalog entry type", localName);
/* 171 */           else if (cex.getExceptionType() == 2) {
/* 172 */             this.debug.message(1, "Invalid catalog entry (base)", localName);
/*     */           }
/*     */         }
/*     */
/* 176 */         entryType = -1;
/* 177 */         entryArgs = new Vector();
/*     */       }
/*     */       else {
/* 180 */         this.baseURIStack.push(this.baseURIStack.peek());
/*     */       }
/*     */
/* 183 */       if (((localName.equals("catalog")) || (localName.equals("group"))) && (atts.getValue("prefer") != null))
/*     */       {
/* 185 */         String override = atts.getValue("prefer");
/*     */
/* 187 */         if (override.equals("public")) {
/* 188 */           override = "yes";
/* 189 */         } else if (override.equals("system")) {
/* 190 */           override = "no";
/*     */         } else {
/* 192 */           this.debug.message(1, "Invalid prefer: must be 'system' or 'public'", localName);
/*     */
/* 195 */           override = this.catalog.getDefaultOverride();
/*     */         }
/*     */
/* 198 */         entryType = Catalog.OVERRIDE;
/* 199 */         entryArgs.add(override);
/* 200 */         this.overrideStack.push(override);
/*     */
/* 202 */         this.debug.message(4, "override", override);
/*     */         try
/*     */         {
/* 205 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 206 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/* 208 */           if (cex.getExceptionType() == 3)
/* 209 */             this.debug.message(1, "Invalid catalog entry type", localName);
/* 210 */           else if (cex.getExceptionType() == 2) {
/* 211 */             this.debug.message(1, "Invalid catalog entry (override)", localName);
/*     */           }
/*     */         }
/*     */
/* 215 */         entryType = -1;
/* 216 */         entryArgs = new Vector();
/*     */       }
/*     */       else {
/* 219 */         this.overrideStack.push(this.overrideStack.peek());
/*     */       }
/*     */
/* 222 */       if (localName.equals("delegatePublic")) {
/* 223 */         if (checkAttributes(atts, "publicIdStartString", "catalog")) {
/* 224 */           entryType = Catalog.DELEGATE_PUBLIC;
/* 225 */           entryArgs.add(atts.getValue("publicIdStartString"));
/* 226 */           entryArgs.add(atts.getValue("catalog"));
/*     */
/* 228 */           this.debug.message(4, "delegatePublic", PublicId.normalize(atts.getValue("publicIdStartString")), atts.getValue("catalog"));
/*     */         }
/*     */
/*     */       }
/* 232 */       else if (localName.equals("delegateSystem")) {
/* 233 */         if (checkAttributes(atts, "systemIdStartString", "catalog")) {
/* 234 */           entryType = Catalog.DELEGATE_SYSTEM;
/* 235 */           entryArgs.add(atts.getValue("systemIdStartString"));
/* 236 */           entryArgs.add(atts.getValue("catalog"));
/*     */
/* 238 */           this.debug.message(4, "delegateSystem", atts.getValue("systemIdStartString"), atts.getValue("catalog"));
/*     */         }
/*     */
/*     */       }
/* 242 */       else if (localName.equals("delegateURI")) {
/* 243 */         if (checkAttributes(atts, "uriStartString", "catalog")) {
/* 244 */           entryType = Catalog.DELEGATE_URI;
/* 245 */           entryArgs.add(atts.getValue("uriStartString"));
/* 246 */           entryArgs.add(atts.getValue("catalog"));
/*     */
/* 248 */           this.debug.message(4, "delegateURI", atts.getValue("uriStartString"), atts.getValue("catalog"));
/*     */         }
/*     */
/*     */       }
/* 252 */       else if (localName.equals("rewriteSystem")) {
/* 253 */         if (checkAttributes(atts, "systemIdStartString", "rewritePrefix")) {
/* 254 */           entryType = Catalog.REWRITE_SYSTEM;
/* 255 */           entryArgs.add(atts.getValue("systemIdStartString"));
/* 256 */           entryArgs.add(atts.getValue("rewritePrefix"));
/*     */
/* 258 */           this.debug.message(4, "rewriteSystem", atts.getValue("systemIdStartString"), atts.getValue("rewritePrefix"));
/*     */         }
/*     */
/*     */       }
/* 262 */       else if (localName.equals("systemSuffix")) {
/* 263 */         if (checkAttributes(atts, "systemIdSuffix", "uri")) {
/* 264 */           entryType = Catalog.SYSTEM_SUFFIX;
/* 265 */           entryArgs.add(atts.getValue("systemIdSuffix"));
/* 266 */           entryArgs.add(atts.getValue("uri"));
/*     */
/* 268 */           this.debug.message(4, "systemSuffix", atts.getValue("systemIdSuffix"), atts.getValue("uri"));
/*     */         }
/*     */
/*     */       }
/* 272 */       else if (localName.equals("rewriteURI")) {
/* 273 */         if (checkAttributes(atts, "uriStartString", "rewritePrefix")) {
/* 274 */           entryType = Catalog.REWRITE_URI;
/* 275 */           entryArgs.add(atts.getValue("uriStartString"));
/* 276 */           entryArgs.add(atts.getValue("rewritePrefix"));
/*     */
/* 278 */           this.debug.message(4, "rewriteURI", atts.getValue("uriStartString"), atts.getValue("rewritePrefix"));
/*     */         }
/*     */
/*     */       }
/* 282 */       else if (localName.equals("uriSuffix")) {
/* 283 */         if (checkAttributes(atts, "uriSuffix", "uri")) {
/* 284 */           entryType = Catalog.URI_SUFFIX;
/* 285 */           entryArgs.add(atts.getValue("uriSuffix"));
/* 286 */           entryArgs.add(atts.getValue("uri"));
/*     */
/* 288 */           this.debug.message(4, "uriSuffix", atts.getValue("uriSuffix"), atts.getValue("uri"));
/*     */         }
/*     */
/*     */       }
/* 292 */       else if (localName.equals("nextCatalog")) {
/* 293 */         if (checkAttributes(atts, "catalog")) {
/* 294 */           entryType = Catalog.CATALOG;
/* 295 */           entryArgs.add(atts.getValue("catalog"));
/*     */
/* 297 */           this.debug.message(4, "nextCatalog", atts.getValue("catalog"));
/*     */         }
/* 299 */       } else if (localName.equals("public")) {
/* 300 */         if (checkAttributes(atts, "publicId", "uri")) {
/* 301 */           entryType = Catalog.PUBLIC;
/* 302 */           entryArgs.add(atts.getValue("publicId"));
/* 303 */           entryArgs.add(atts.getValue("uri"));
/*     */
/* 305 */           this.debug.message(4, "public", PublicId.normalize(atts.getValue("publicId")), atts.getValue("uri"));
/*     */         }
/*     */
/*     */       }
/* 309 */       else if (localName.equals("system")) {
/* 310 */         if (checkAttributes(atts, "systemId", "uri")) {
/* 311 */           entryType = Catalog.SYSTEM;
/* 312 */           entryArgs.add(atts.getValue("systemId"));
/* 313 */           entryArgs.add(atts.getValue("uri"));
/*     */
/* 315 */           this.debug.message(4, "system", atts.getValue("systemId"), atts.getValue("uri"));
/*     */         }
/*     */
/*     */       }
/* 319 */       else if (localName.equals("uri")) {
/* 320 */         if (checkAttributes(atts, "name", "uri")) {
/* 321 */           entryType = Catalog.URI;
/* 322 */           entryArgs.add(atts.getValue("name"));
/* 323 */           entryArgs.add(atts.getValue("uri"));
/*     */
/* 325 */           this.debug.message(4, "uri", atts.getValue("name"), atts.getValue("uri"));
/*     */         }
/*     */
/*     */       }
/* 329 */       else if (!localName.equals("catalog"))
/*     */       {
/* 331 */         if (!localName.equals("group"))
/*     */         {
/* 335 */           this.debug.message(1, "Invalid catalog entry type", localName);
/*     */         }
/*     */       }
/* 338 */       if (entryType >= 0) {
/*     */         try {
/* 340 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 341 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/* 343 */           if (cex.getExceptionType() == 3)
/* 344 */             this.debug.message(1, "Invalid catalog entry type", localName);
/* 345 */           else if (cex.getExceptionType() == 2) {
/* 346 */             this.debug.message(1, "Invalid catalog entry", localName);
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */
/* 352 */     if ((namespaceURI != null) && ("urn:oasis:names:tc:entity:xmlns:tr9401:catalog".equals(namespaceURI)) && (!inExtension))
/*     */     {
/* 356 */       if (atts.getValue("xml:base") != null) {
/* 357 */         String baseURI = atts.getValue("xml:base");
/* 358 */         entryType = Catalog.BASE;
/* 359 */         entryArgs.add(baseURI);
/* 360 */         this.baseURIStack.push(baseURI);
/*     */
/* 362 */         this.debug.message(4, "xml:base", baseURI);
/*     */         try
/*     */         {
/* 365 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 366 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/* 368 */           if (cex.getExceptionType() == 3)
/* 369 */             this.debug.message(1, "Invalid catalog entry type", localName);
/* 370 */           else if (cex.getExceptionType() == 2) {
/* 371 */             this.debug.message(1, "Invalid catalog entry (base)", localName);
/*     */           }
/*     */         }
/*     */
/* 375 */         entryType = -1;
/* 376 */         entryArgs = new Vector();
/*     */       }
/*     */       else {
/* 379 */         this.baseURIStack.push(this.baseURIStack.peek());
/*     */       }
/*     */
/* 382 */       if (localName.equals("doctype")) {
/* 383 */         entryType = Catalog.DOCTYPE;
/* 384 */         entryArgs.add(atts.getValue("name"));
/* 385 */         entryArgs.add(atts.getValue("uri"));
/* 386 */       } else if (localName.equals("document")) {
/* 387 */         entryType = Catalog.DOCUMENT;
/* 388 */         entryArgs.add(atts.getValue("uri"));
/* 389 */       } else if (localName.equals("dtddecl")) {
/* 390 */         entryType = Catalog.DTDDECL;
/* 391 */         entryArgs.add(atts.getValue("publicId"));
/* 392 */         entryArgs.add(atts.getValue("uri"));
/* 393 */       } else if (localName.equals("entity")) {
/* 394 */         entryType = Catalog.ENTITY;
/* 395 */         entryArgs.add(atts.getValue("name"));
/* 396 */         entryArgs.add(atts.getValue("uri"));
/* 397 */       } else if (localName.equals("linktype")) {
/* 398 */         entryType = Catalog.LINKTYPE;
/* 399 */         entryArgs.add(atts.getValue("name"));
/* 400 */         entryArgs.add(atts.getValue("uri"));
/* 401 */       } else if (localName.equals("notation")) {
/* 402 */         entryType = Catalog.NOTATION;
/* 403 */         entryArgs.add(atts.getValue("name"));
/* 404 */         entryArgs.add(atts.getValue("uri"));
/* 405 */       } else if (localName.equals("sgmldecl")) {
/* 406 */         entryType = Catalog.SGMLDECL;
/* 407 */         entryArgs.add(atts.getValue("uri"));
/*     */       }
/*     */       else {
/* 410 */         this.debug.message(1, "Invalid catalog entry type", localName);
/*     */       }
/*     */
/* 413 */       if (entryType >= 0)
/*     */         try {
/* 415 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 416 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/* 418 */           if (cex.getExceptionType() == 3)
/* 419 */             this.debug.message(1, "Invalid catalog entry type", localName);
/* 420 */           else if (cex.getExceptionType() == 2)
View Full Code Here

/* 465 */         entryArgs.add(baseURI);
/*     */
/* 467 */         this.debug.message(4, "(reset) xml:base", baseURI);
/*     */         try
/*     */         {
/* 470 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 471 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/* 473 */           if (cex.getExceptionType() == 3)
/* 474 */             this.debug.message(1, "Invalid catalog entry type", localName);
/* 475 */           else if (cex.getExceptionType() == 2) {
/* 476 */             this.debug.message(1, "Invalid catalog entry (rbase)", localName);
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */
/* 482 */     if ((namespaceURI != null) && ("urn:oasis:names:tc:entity:xmlns:xml:catalog".equals(namespaceURI)) && (!inExtension))
/*     */     {
/* 484 */       if ((localName.equals("catalog")) || (localName.equals("group"))) {
/* 485 */         String popOverride = (String)this.overrideStack.pop();
/* 486 */         String override = (String)this.overrideStack.peek();
/*     */
/* 488 */         if (!override.equals(popOverride)) {
/* 489 */           entryType = Catalog.OVERRIDE;
/* 490 */           entryArgs.add(override);
/* 491 */           this.overrideStack.push(override);
/*     */
/* 493 */           this.debug.message(4, "(reset) override", override);
/*     */           try
/*     */           {
/* 496 */             CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 497 */             this.catalog.addEntry(ce);
/*     */           } catch (CatalogException cex) {
/* 499 */             if (cex.getExceptionType() == 3)
/* 500 */               this.debug.message(1, "Invalid catalog entry type", localName);
/* 501 */             else if (cex.getExceptionType() == 2) {
View Full Code Here

/* 150 */       this.debug.message(1, "Invalid catalog entry type", localName);
/*     */     }
/*     */
/* 153 */     if (entryType >= 0)
/*     */       try {
/* 155 */         CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 156 */         this.catalog.addEntry(ce);
/*     */       } catch (CatalogException cex) {
/* 158 */         if (cex.getExceptionType() == 3)
/* 159 */           this.debug.message(1, "Invalid catalog entry type", localName);
/* 160 */         else if (cex.getExceptionType() == 2)
View Full Code Here

/*    */
/* 114 */           for (int count = 0; count < numArgs; count++) {
/* 115 */             args.addElement(nextToken());
/*    */           }
/*    */
/* 118 */           catalog.addEntry(new CatalogEntry(entryToken, args));
/*    */         } catch (CatalogException cex) {
/* 120 */           if (cex.getExceptionType() == 3) {
/* 121 */             if (unknownEntry == null) {
/* 122 */               unknownEntry = new Vector();
/*    */             }
View Full Code Here

/*  82 */         this.baseURIStack.push(baseURI);
/*     */
/*  84 */         this.debug.message(4, "xml:base", baseURI);
/*     */         try
/*     */         {
/*  87 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/*  88 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/*  90 */           if (cex.getExceptionType() == 3)
/*  91 */             this.debug.message(1, "Invalid catalog entry type", localName);
/*  92 */           else if (cex.getExceptionType() == 2) {
/*  93 */             this.debug.message(1, "Invalid catalog entry (base)", localName);
/*     */           }
/*     */         }
/*     */
/*  97 */         entryType = -1;
/*  98 */         entryArgs = new Vector();
/*     */       } else {
/* 100 */         this.baseURIStack.push(this.baseURIStack.peek());
/*     */       }
/*     */
/* 103 */       if (localName.equals("uriSuffix")) {
/* 104 */         if (checkAttributes(atts, "suffix", "uri")) {
/* 105 */           entryType = Resolver.URISUFFIX;
/* 106 */           entryArgs.add(atts.getValue("suffix"));
/* 107 */           entryArgs.add(atts.getValue("uri"));
/*     */
/* 109 */           this.debug.message(4, "uriSuffix", atts.getValue("suffix"), atts.getValue("uri"));
/*     */         }
/*     */
/*     */       }
/* 113 */       else if (localName.equals("systemSuffix")) {
/* 114 */         if (checkAttributes(atts, "suffix", "uri")) {
/* 115 */           entryType = Resolver.SYSTEMSUFFIX;
/* 116 */           entryArgs.add(atts.getValue("suffix"));
/* 117 */           entryArgs.add(atts.getValue("uri"));
/*     */
/* 119 */           this.debug.message(4, "systemSuffix", atts.getValue("suffix"), atts.getValue("uri"));
/*     */         }
/*     */
/*     */       }
/*     */       else
/*     */       {
/* 125 */         this.debug.message(1, "Invalid catalog entry type", localName);
/*     */       }
/*     */
/* 128 */       if (entryType >= 0)
/*     */         try {
/* 130 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 131 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/* 133 */           if (cex.getExceptionType() == 3)
/* 134 */             this.debug.message(1, "Invalid catalog entry type", localName);
/* 135 */           else if (cex.getExceptionType() == 2)
View Full Code Here

/* 167 */         entryArgs.add(baseURI);
/*     */
/* 169 */         this.debug.message(4, "(reset) xml:base", baseURI);
/*     */         try
/*     */         {
/* 172 */           CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
/* 173 */           this.catalog.addEntry(ce);
/*     */         } catch (CatalogException cex) {
/* 175 */           if (cex.getExceptionType() == 3)
/* 176 */             this.debug.message(1, "Invalid catalog entry type", localName);
/* 177 */           else if (cex.getExceptionType() == 2)
View Full Code Here

/*     */
/* 153 */           for (int count = 0; count < numArgs; count++) {
/* 154 */             args.addElement(nextToken());
/*     */           }
/*     */
/* 157 */           catalog.addEntry(new CatalogEntry(entryToken, args));
/*     */         } catch (CatalogException cex) {
/* 159 */           if (cex.getExceptionType() == 3) {
/* 160 */             if (unknownEntry == null) {
/* 161 */               unknownEntry = new Vector();
/*     */             }
View Full Code Here

    /**
     * Adds a new Entry to the catalog
     */
    private void addEntry(String type, Vector args) {
        try {
            CatalogEntry entry = new CatalogEntry(type, args);
            catalog.addEntry(entry);
        } catch (CatalogException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

TOP

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

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.