Example #1
0
 /**
  * This will look up the value of a SAX property.
  *
  * @param name <code>String</code> the property name, which is a fully-qualified URI.
  * @return <code>Object</code> the current value of the property.
  * @throws SAXNotRecognizedException when SAXOutputter does not recognize the property name.
  * @throws SAXNotSupportedException when SAXOutputter recognizes the property name but cannot
  *     determine its value at this time.
  */
 public Object getProperty(String name)
     throws SAXNotRecognizedException, SAXNotSupportedException {
   if ((SAX_PROPERTY_LEXICAL_HANDLER.equals(name))
       || (SAX_PROPERTY_LEXICAL_HANDLER_ALT.equals(name))) {
     return this.getLexicalHandler();
   }
   if ((SAX_PROPERTY_DECLARATION_HANDLER.equals(name))
       || (SAX_PROPERTY_DECLARATION_HANDLER_ALT.equals(name))) {
     return this.getDeclHandler();
   }
   throw new SAXNotRecognizedException(name);
 }
Example #2
0
 /**
  * This will set the value of a SAX property. This method is also the standard mechanism for
  * setting extended handlers.
  *
  * <p>SAXOutputter currently supports the following SAX properties:
  *
  * <dl>
  *   <dt><code>http://xml.org/sax/properties/lexical-handler</code>
  *   <dd><strong>data type:</strong> <code>org.xml.sax.ext.LexicalHandler</code>
  *   <dd><strong>description:</strong> An optional extension handler for lexical events like
  *       comments.
  *   <dd><strong>access:</strong> read/write
  *   <dt><code>http://xml.org/sax/properties/declaration-handler</code>
  *   <dd><strong>data type:</strong> <code>org.xml.sax.ext.DeclHandler</code>
  *   <dd><strong>description:</strong> An optional extension handler for DTD-related events other
  *       than notations and unparsed entities.
  *   <dd><strong>access:</strong> read/write
  * </dl>
  *
  * @param name <code>String</code> the property name, which is a fully-qualified URI.
  * @param value <code>Object</code> the requested value for the property.
  * @throws SAXNotRecognizedException when SAXOutputter does not recognize the property name.
  * @throws SAXNotSupportedException when SAXOutputter recognizes the property name but cannot set
  *     the requested value.
  */
 public void setProperty(String name, Object value)
     throws SAXNotRecognizedException, SAXNotSupportedException {
   if ((SAX_PROPERTY_LEXICAL_HANDLER.equals(name))
       || (SAX_PROPERTY_LEXICAL_HANDLER_ALT.equals(name))) {
     this.setLexicalHandler((LexicalHandler) value);
   } else {
     if ((SAX_PROPERTY_DECLARATION_HANDLER.equals(name))
         || (SAX_PROPERTY_DECLARATION_HANDLER_ALT.equals(name))) {
       this.setDeclHandler((DeclHandler) value);
     } else {
       throw new SAXNotRecognizedException(name);
     }
   }
 }