本文整理汇总了Java中com.sun.org.apache.xml.internal.resolver.CatalogException类的典型用法代码示例。如果您正苦于以下问题:Java CatalogException类的具体用法?Java CatalogException怎么用?Java CatalogException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CatalogException类属于com.sun.org.apache.xml.internal.resolver包,在下文中一共展示了CatalogException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startElement
import com.sun.org.apache.xml.internal.resolver.CatalogException; //导入依赖的package包/类
/**
* The SAX <code>startElement</code> method recognizes elements
* from the plain catalog format and instantiates CatalogEntry
* objects for them.
*
* @param namespaceURI The namespace name of the element.
* @param localName The local name of the element.
* @param qName The QName of the element.
* @param atts The list of attributes on the element.
*
* @see CatalogEntry
*/
public void startElement (String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException {
int entryType = -1;
Vector entryArgs = new Vector();
if (localName.equals("Base")) {
entryType = catalog.BASE;
entryArgs.add(atts.getValue("HRef"));
catalog.getCatalogManager().debug.message(4, "Base", atts.getValue("HRef"));
} else if (localName.equals("Delegate")) {
entryType = catalog.DELEGATE_PUBLIC;
entryArgs.add(atts.getValue("PublicId"));
entryArgs.add(atts.getValue("HRef"));
catalog.getCatalogManager().debug.message(4, "Delegate",
PublicId.normalize(atts.getValue("PublicId")),
atts.getValue("HRef"));
} else if (localName.equals("Extend")) {
entryType = catalog.CATALOG;
entryArgs.add(atts.getValue("HRef"));
catalog.getCatalogManager().debug.message(4, "Extend", atts.getValue("HRef"));
} else if (localName.equals("Map")) {
entryType = catalog.PUBLIC;
entryArgs.add(atts.getValue("PublicId"));
entryArgs.add(atts.getValue("HRef"));
catalog.getCatalogManager().debug.message(4, "Map",
PublicId.normalize(atts.getValue("PublicId")),
atts.getValue("HRef"));
} else if (localName.equals("Remap")) {
entryType = catalog.SYSTEM;
entryArgs.add(atts.getValue("SystemId"));
entryArgs.add(atts.getValue("HRef"));
catalog.getCatalogManager().debug.message(4, "Remap",
atts.getValue("SystemId"),
atts.getValue("HRef"));
} else if (localName.equals("XMLCatalog")) {
// nop, start of catalog
} else {
// This is equivalent to an invalid catalog entry type
catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
}
if (entryType >= 0) {
try {
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
catalog.addEntry(ce);
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
catalog.getCatalogManager().debug.message(1, "Invalid catalog entry type", localName);
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", localName);
}
}
}
}
示例2: endElement
import com.sun.org.apache.xml.internal.resolver.CatalogException; //导入依赖的package包/类
/** The SAX <code>endElement</code> method does nothing. */
public void endElement (String namespaceURI,
String localName,
String qName)
throws SAXException {
super.endElement(namespaceURI, localName, qName);
// Check after popping the stack so we don't erroneously think we
// are our own extension namespace...
boolean inExtension = inExtensionNamespace();
int entryType = -1;
Vector entryArgs = new Vector();
if (namespaceURI != null
&& (extendedNamespaceName.equals(namespaceURI))
&& !inExtension) {
String popURI = (String) baseURIStack.pop();
String baseURI = (String) baseURIStack.peek();
if (!baseURI.equals(popURI)) {
entryType = catalog.BASE;
entryArgs.add(baseURI);
debug.message(4, "(reset) xml:base", baseURI);
try {
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
catalog.addEntry(ce);
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
debug.message(1, "Invalid catalog entry type", localName);
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
debug.message(1, "Invalid catalog entry (rbase)", localName);
}
}
}
}
}
示例3: readCatalog
import com.sun.org.apache.xml.internal.resolver.CatalogException; //导入依赖的package包/类
public void readCatalog(Catalog catalog, InputStream is)
throws MalformedURLException, IOException {
catfile = is;
if (catfile == null) {
return;
}
Vector unknownEntry = null;
try {
while (true) {
String token = nextToken();
if (token == null) {
if (unknownEntry != null) {
catalog.unknownEntry(unknownEntry);
unknownEntry = null;
}
catfile.close();
catfile = null;
return;
}
String entryToken = null;
if (caseSensitive) {
entryToken = token;
} else {
entryToken = token.toUpperCase(Locale.ENGLISH);
}
try {
int type = CatalogEntry.getEntryType(entryToken);
int numArgs = CatalogEntry.getEntryArgCount(type);
Vector args = new Vector();
if (unknownEntry != null) {
catalog.unknownEntry(unknownEntry);
unknownEntry = null;
}
for (int count = 0; count < numArgs; count++) {
args.addElement(nextToken());
}
catalog.addEntry(new CatalogEntry(entryToken, args));
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
if (unknownEntry == null) {
unknownEntry = new Vector();
}
unknownEntry.addElement(token);
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
unknownEntry = null;
} else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
catalog.getCatalogManager().debug.message(1, cex.getMessage());
}
}
}
} catch (CatalogException cex2) {
if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) {
catalog.getCatalogManager().debug.message(1, cex2.getMessage());
}
}
}
示例4: startElement
import com.sun.org.apache.xml.internal.resolver.CatalogException; //导入依赖的package包/类
/**
* The SAX <code>startElement</code> method recognizes elements
* from the plain catalog format and instantiates CatalogEntry
* objects for them.
*
* @param namespaceURI The namespace name of the element.
* @param localName The local name of the element.
* @param qName The QName of the element.
* @param atts The list of attributes on the element.
*
* @see CatalogEntry
*/
public void startElement (String namespaceURI,
String localName,
String qName,
Attributes atts)
throws SAXException {
int entryType = -1;
Vector entryArgs = new Vector();
if (localName.equals("Base")) {
entryType = Catalog.BASE;
entryArgs.add(atts.getValue("HRef"));
debug.message(4, "Base", atts.getValue("HRef"));
} else if (localName.equals("Delegate")) {
entryType = Catalog.DELEGATE_PUBLIC;
entryArgs.add(atts.getValue("PublicID"));
entryArgs.add(atts.getValue("HRef"));
debug.message(4, "Delegate",
PublicId.normalize(atts.getValue("PublicID")),
atts.getValue("HRef"));
} else if (localName.equals("Extend")) {
entryType = Catalog.CATALOG;
entryArgs.add(atts.getValue("HRef"));
debug.message(4, "Extend", atts.getValue("HRef"));
} else if (localName.equals("Map")) {
entryType = Catalog.PUBLIC;
entryArgs.add(atts.getValue("PublicID"));
entryArgs.add(atts.getValue("HRef"));
debug.message(4, "Map",
PublicId.normalize(atts.getValue("PublicID")),
atts.getValue("HRef"));
} else if (localName.equals("Remap")) {
entryType = Catalog.SYSTEM;
entryArgs.add(atts.getValue("SystemID"));
entryArgs.add(atts.getValue("HRef"));
debug.message(4, "Remap",
atts.getValue("SystemID"),
atts.getValue("HRef"));
} else if (localName.equals("XCatalog")) {
// nop, start of catalog
} else {
// This is equivalent to an invalid catalog entry type
debug.message(1, "Invalid catalog entry type", localName);
}
if (entryType >= 0) {
try {
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
catalog.addEntry(ce);
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
debug.message(1, "Invalid catalog entry type", localName);
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
debug.message(1, "Invalid catalog entry", localName);
}
}
}
}
示例5: endElement
import com.sun.org.apache.xml.internal.resolver.CatalogException; //导入依赖的package包/类
/** The SAX <code>endElement</code> method does nothing. */
public void endElement (String namespaceURI,
String localName,
String qName)
throws SAXException {
super.endElement(namespaceURI, localName, qName);
// Check after popping the stack so we don't erroneously think we
// are our own extension namespace...
boolean inExtension = inExtensionNamespace();
int entryType = -1;
Vector entryArgs = new Vector();
if (namespaceURI != null
&& (extendedNamespaceName.equals(namespaceURI))
&& !inExtension) {
String popURI = (String) baseURIStack.pop();
String baseURI = (String) baseURIStack.peek();
if (!baseURI.equals(popURI)) {
entryType = Catalog.BASE;
entryArgs.add(baseURI);
debug.message(4, "(reset) xml:base", baseURI);
try {
CatalogEntry ce = new CatalogEntry(entryType, entryArgs);
catalog.addEntry(ce);
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
debug.message(1, "Invalid catalog entry type", localName);
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
debug.message(1, "Invalid catalog entry (rbase)", localName);
}
}
}
}
}
示例6: readCatalog
import com.sun.org.apache.xml.internal.resolver.CatalogException; //导入依赖的package包/类
public void readCatalog(Catalog catalog, InputStream is)
throws MalformedURLException, IOException {
catfile = is;
if (catfile == null) {
return;
}
Vector unknownEntry = null;
try {
while (true) {
String token = nextToken();
if (token == null) {
if (unknownEntry != null) {
catalog.unknownEntry(unknownEntry);
unknownEntry = null;
}
catfile.close();
catfile = null;
return;
}
String entryToken = null;
if (caseSensitive) {
entryToken = token;
} else {
entryToken = token.toUpperCase();
}
try {
int type = CatalogEntry.getEntryType(entryToken);
int numArgs = CatalogEntry.getEntryArgCount(type);
Vector args = new Vector();
if (unknownEntry != null) {
catalog.unknownEntry(unknownEntry);
unknownEntry = null;
}
for (int count = 0; count < numArgs; count++) {
args.addElement(nextToken());
}
catalog.addEntry(new CatalogEntry(entryToken, args));
} catch (CatalogException cex) {
if (cex.getExceptionType() == CatalogException.INVALID_ENTRY_TYPE) {
if (unknownEntry == null) {
unknownEntry = new Vector();
}
unknownEntry.addElement(token);
} else if (cex.getExceptionType() == CatalogException.INVALID_ENTRY) {
catalog.getCatalogManager().debug.message(1, "Invalid catalog entry", token);
unknownEntry = null;
} else if (cex.getExceptionType() == CatalogException.UNENDED_COMMENT) {
catalog.getCatalogManager().debug.message(1, cex.getMessage());
}
}
}
} catch (CatalogException cex2) {
if (cex2.getExceptionType() == CatalogException.UNENDED_COMMENT) {
catalog.getCatalogManager().debug.message(1, cex2.getMessage());
}
}
}
示例7: readCatalog
import com.sun.org.apache.xml.internal.resolver.CatalogException; //导入依赖的package包/类
/**
* Read the catalog behind the specified URL.
*
* @see #readCatalog(Catalog, InputStream)
*
* @param catalog The catalog for which we are reading.
* @param fileUrl The URL of the document that should be read.
*
* @throws MalformedURLException if the specified URL cannot be
* turned into a URL object.
* @throws IOException if the URL cannot be read.
* @throws UnknownCatalogFormatException if the catalog format is
* not recognized.
* @throws UnparseableCatalogException if the catalog cannot be parsed.
* (For example, if it is supposed to be XML and isn't well-formed.)
*/
public void readCatalog(Catalog catalog, String fileUrl)
throws MalformedURLException, IOException, CatalogException {
URL url = new URL(fileUrl);
URLConnection urlCon = url.openConnection();
readCatalog(catalog, urlCon.getInputStream());
}
示例8: readCatalog
import com.sun.org.apache.xml.internal.resolver.CatalogException; //导入依赖的package包/类
/**
* Read a catalog from a file.
*
* <p>This class reads a catalog from a URL.</p>
*
* @param catalog The catalog for which this reader is called.
* @param fileUrl The URL of a document to be read.
* @throws MalformedURLException if the specified URL cannot be
* turned into a URL object.
* @throws IOException if the URL cannot be read.
* @throws UnknownCatalogFormatException if the catalog format is
* not recognized.
* @throws UnparseableCatalogException if the catalog cannot be parsed.
* (For example, if it is supposed to be XML and isn't well-formed.)
*/
public void readCatalog(Catalog catalog, String fileUrl)
throws MalformedURLException, IOException, CatalogException;