Java Code Examples for org.xml.sax.XMLReader#getContentHandler()

The following examples show how to use org.xml.sax.XMLReader#getContentHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TrAXFilter.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/** Set the parent reader.
 *
 * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which 
 * this filter will obtain its events and to which it will pass its 
 * configuration requests.  The parent may itself be another filter.</p>
 *
 * <p>If there is no parent reader set, any attempt to parse
 * or to set or get a feature or property will fail.</p>
 *
 * @param parent The parent XML reader.
 * @throws java.lang.NullPointerException If the parent is null.
 */
public void setParent (XMLReader parent)
{ 
  super.setParent(parent);
  
  if(null != parent.getContentHandler())
    this.setContentHandler(parent.getContentHandler());

  // Not really sure if we should do this here, but 
  // it seems safer in case someone calls parse() on 
  // the parent.
  setupParse ();
}
 
Example 2
Source File: WrapperContentHandler.java    From html-textview with Apache License 2.0 5 votes vote down vote up
@Override
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) {
    if (mContentHandler == null) {
        mSpannableStringBuilder = output;
        mContentHandler = xmlReader.getContentHandler();
        xmlReader.setContentHandler(this);
    }
}