|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.arbortext.catalog.XMLCatalogReader
Parses XML Catalog files.
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.
This class reads XML Catalog files, returning a stream of tokens. At present, it recognizes John Cowan's XML Catalogs (formerly XCatalogs). In the future, additional XML Catalog formats may be supported.
This code interrogates the following non-standard system properties:
Sets the debug level. A value of 0 is assumed if the property is not set or is not a number.
Catalog
Field Summary | |
int |
debug
The debug level |
Constructor Summary | |
XMLCatalogReader()
Construct an XMLCatalogReader object. |
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
The SAX characters method. |
void |
endDocument()
The SAX endDocument method. |
void |
endElement(java.lang.String name)
The SAX endElement method. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
The SAX ignorableWhitespace method. |
CatalogEntry |
nextEntry()
Get the next entry from the file |
void |
parseCatalog(java.lang.String fileUrl)
Attempt to parse an XML Catalog file. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
The SAX processingInstruction method. |
void |
setDocumentLocator(org.xml.sax.Locator locator)
The SAX setDocumentLocator method. |
void |
setParserClass(java.lang.String parser)
Sets the parser class, enabling XML Catalog parsing. |
void |
startDocument()
The SAX startDocument method. |
void |
startElement(java.lang.String name,
org.xml.sax.AttributeList atts)
The SAX startElement method. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public int debug
The debug level
In general, higher numbers produce more information:
Constructor Detail |
public XMLCatalogReader()
Construct an XMLCatalogReader object.
Method Detail |
public void setParserClass(java.lang.String parser)
Sets the parser class, enabling XML Catalog parsing.
Sets the parser class that will be used for loading XML Catalogs.
If this method is not called, all attempts to use the
XMLCatalogParser
will fail, throwing a
NoXMLParserException
.
parser
- The name of a class implementing the SAX Parser
interface to be used for subsequent XML Catalog parsing.NoXMLParserException
public void parseCatalog(java.lang.String fileUrl) throws org.xml.sax.SAXException, java.io.IOException, NotXMLCatalogException, NoXMLParserException, UnknownCatalogFormatException, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassCastException
Attempt to parse an XML Catalog file.
fileUrl
- The URL or filename of the catalog file to processcatParser
- A SAX-compliant parser to use for reading the filespublic CatalogEntry nextEntry() throws java.io.IOException
Get the next entry from the file
public void setDocumentLocator(org.xml.sax.Locator locator)
The SAX setDocumentLocator
method. Does nothing.
public void startDocument() throws org.xml.sax.SAXException
The SAX startDocument
method. Does nothing.
public void endDocument() throws org.xml.sax.SAXException
The SAX endDocument
method. Does nothing.
public void startElement(java.lang.String name, org.xml.sax.AttributeList atts) throws org.xml.sax.SAXException
The SAX startElement
method.
This element attempts to identify the type of catalog
by looking at the name of the first element encountered.
If it recognizes the element, it sets the catalogType
appropriately.
After the catalog type has been identified, the appropriate entry parser is called for each subsequent element in the catalog.
name
- The name of the element.atts
- The list of attributes on the element.public void endElement(java.lang.String name) throws org.xml.sax.SAXException
The SAX endElement
method. Does nothing.
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
The SAX characters
method. Does nothing.
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
The SAX ignorableWhitespace
method. Does nothing.
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
The SAX processingInstruction
method. Does nothing.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |