📄 digester.java
字号:
*/
public String getCurrentElementName() {
String elementName = match;
int lastSlash = elementName.lastIndexOf('/');
if (lastSlash >= 0) {
elementName = elementName.substring(lastSlash + 1);
}
return (elementName);
}
/**
* Return the debugging detail level of our currently enabled logger.
*
* @deprecated This method now always returns 0. Digester uses the apache
* jakarta commons-logging library; see the documentation for that library
* for more information.
*/
public int getDebug() {
return (0);
}
/**
* Set the debugging detail level of our currently enabled logger.
*
* @param debug New debugging detail level (0=off, increasing integers
* for more detail)
*
* @deprecated This method now has no effect at all. Digester uses
* the apache jakarta comons-logging library; see the documentation
* for that library for more information.
*/
public void setDebug(int debug) {
; // No action is taken
}
/**
* Return the error handler for this Digester.
*/
public ErrorHandler getErrorHandler() {
return (this.errorHandler);
}
/**
* Set the error handler for this Digester.
*
* @param errorHandler The new error handler
*/
public void setErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
/**
* Return the SAXParserFactory we will use, creating one if necessary.
*/
public SAXParserFactory getFactory() {
if (factory == null) {
factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(namespaceAware);
factory.setValidating(validating);
}
return (factory);
}
/**
* Returns a flag indicating whether the requested feature is supported
* by the underlying implementation of <code>org.xml.sax.XMLReader</code>.
* See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description"
* http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description</a>
* for information about the standard SAX2 feature flags.
*
* @param feature Name of the feature to inquire about
*
* @exception ParserConfigurationException if a parser configuration error
* occurs
* @exception SAXNotRecognizedException if the property name is
* not recognized
* @exception SAXNotSupportedException if the property name is
* recognized but not supported
*/
public boolean getFeature(String feature)
throws ParserConfigurationException, SAXNotRecognizedException,
SAXNotSupportedException {
return (getFactory().getFeature(feature));
}
/**
* Sets a flag indicating whether the requested feature is supported
* by the underlying implementation of <code>org.xml.sax.XMLReader</code>.
* See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description"
* http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description</a>
* for information about the standard SAX2 feature flags. In order to be
* effective, this method must be called <strong>before</strong> the
* <code>getParser()</code> method is called for the first time, either
* directly or indirectly.
*
* @param feature Name of the feature to set the status for
* @param value The new value for this feature
*
* @exception ParserConfigurationException if a parser configuration error
* occurs
* @exception SAXNotRecognizedException if the property name is
* not recognized
* @exception SAXNotSupportedException if the property name is
* recognized but not supported
*/
public void setFeature(String feature, boolean value)
throws ParserConfigurationException, SAXNotRecognizedException,
SAXNotSupportedException {
getFactory().setFeature(feature, value);
}
/**
* Return the current Logger associated with this instance of the Digester
*/
public Log getLogger() {
return log;
}
/**
* Set the current logger for this Digester.
*/
public void setLogger(Log log) {
this.log = log;
}
/**
* Gets the logger used for logging SAX-related information.
* <strong>Note</strong> the output is finely grained.
*
* @since 1.6
*/
public Log getSAXLogger() {
return saxLog;
}
/**
* Sets the logger used for logging SAX-related information.
* <strong>Note</strong> the output is finely grained.
* @param saxLog Log, not null
*
* @since 1.6
*/
public void setSAXLogger(Log saxLog) {
this.saxLog = saxLog;
}
/**
* Return the current rule match path
*/
public String getMatch() {
return match;
}
/**
* Return the "namespace aware" flag for parsers we create.
*/
public boolean getNamespaceAware() {
return (this.namespaceAware);
}
/**
* Set the "namespace aware" flag for parsers we create.
*
* @param namespaceAware The new "namespace aware" flag
*/
public void setNamespaceAware(boolean namespaceAware) {
this.namespaceAware = namespaceAware;
}
/**
* Set the publid id of the current file being parse.
* @param publicId the DTD/Schema public's id.
*/
public void setPublicId(String publicId){
this.publicId = publicId;
}
/**
* Return the public identifier of the DTD we are currently
* parsing under, if any.
*/
public String getPublicId() {
return (this.publicId);
}
/**
* Return the namespace URI that will be applied to all subsequently
* added <code>Rule</code> objects.
*/
public String getRuleNamespaceURI() {
return (getRules().getNamespaceURI());
}
/**
* Set the namespace URI that will be applied to all subsequently
* added <code>Rule</code> objects.
*
* @param ruleNamespaceURI Namespace URI that must match on all
* subsequently added rules, or <code>null</code> for matching
* regardless of the current namespace URI
*/
public void setRuleNamespaceURI(String ruleNamespaceURI) {
getRules().setNamespaceURI(ruleNamespaceURI);
}
/**
* Return the SAXParser we will use to parse the input stream. If there
* is a problem creating the parser, return <code>null</code>.
*/
public SAXParser getParser() {
// Return the parser we already created (if any)
if (parser != null) {
return (parser);
}
// Create a new parser
try {
if (validating) {
Properties properties = new Properties();
properties.put("SAXParserFactory", getFactory());
if (schemaLocation != null) {
properties.put("schemaLocation", schemaLocation);
properties.put("schemaLanguage", schemaLanguage);
}
parser = ParserFeatureSetterFactory.newSAXParser(properties); } else {
parser = getFactory().newSAXParser();
}
} catch (Exception e) {
log.error("Digester.getParser: ", e);
return (null);
}
return (parser);
}
/**
* Return the current value of the specified property for the underlying
* <code>XMLReader</code> implementation.
* See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description"
* http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description</a>
* for information about the standard SAX2 properties.
*
* @param property Property name to be retrieved
*
* @exception SAXNotRecognizedException if the property name is
* not recognized
* @exception SAXNotSupportedException if the property name is
* recognized but not supported
*/
public Object getProperty(String property)
throws SAXNotRecognizedException, SAXNotSupportedException {
return (getParser().getProperty(property));
}
/**
* Set the current value of the specified property for the underlying
* <code>XMLReader</code> implementation.
* See <a href="http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description"
* http://www.saxproject.org/apidoc/xml/sax/package-summary.html#package-description</a>
* for information about the standard SAX2 properties.
*
* @param property Property name to be set
* @param value Property value to be set
*
* @exception SAXNotRecognizedException if the property name is
* not recognized
* @exception SAXNotSupportedException if the property name is
* recognized but not supported
*/
public void setProperty(String property, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
getParser().setProperty(property, value);
}
/**
* By setting the reader in the constructor, you can bypass JAXP and
* be able to use digester in Weblogic 6.0.
*
* @deprecated Use getXMLReader() instead, which can throw a
* SAXException if the reader cannot be instantiated
*/
public XMLReader getReader() {
try {
return (getXMLReader());
} catch (SAXException e) {
log.error("Cannot get XMLReader", e);
return (null);
}
}
/**
* Return the <code>Rules</code> implementation object containing our
* rules collection and associated matching policy. If none has been
* established, a default implementation will be created and returned.
*/
public Rules getRules() {
if (this.rules == null) {
this.rules = new RulesBase();
this.rules.setDigester(this);
}
return (this.rules);
}
/**
* Set the <code>Rules</code> implementation object containing our
* rules collection and associated matching policy.
*
* @param rules New Rules implementation
*/
public void setRules(Rules rules) {
this.rules = rules;
this.rules.setDigester(this);
}
/**
* Return the XML Schema URI used for validating an XML instance.
*/
public String getSchema() {
return (this.schemaLocation);
}
/**
* Set the XML Schema URI used for validating a XML Instance.
*
* @param schemaLocation a URI to the schema.
*/
public void setSchema(String schemaLocation){
this.schemaLocation = schemaLocation;
}
/**
* Return the XML Schema language used when parsing.
*/
public String getSchemaLanguage() {
return (this.schemaLanguage);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -