/** startContent: Test if a matching ID attribute was found; if so, start outputting. */
 public void startContent() throws XPathException {
   if (activeDepth > 0) {
     super.startContent();
   } else if (matched) {
     activeDepth = 1;
     super.startContent();
   }
 }
 protected void declareNamespacesForStartElement() throws XPathException {
   if (activeDepth == 1) {
     declareAllNamespaces();
   } else {
     super.declareNamespacesForStartElement();
   }
 }
 /** startElement */
 public void startElement(int nameCode, int typeCode, int locationId, int properties)
     throws XPathException {
   matched = false;
   if (activeDepth > 0) {
     activeDepth++;
   }
   super.startElement(nameCode, typeCode, locationId, properties); // this remembers the details
 }
 /**
  * Notify an attribute. Attributes are notified after the startElement event, and before any
  * children. Namespaces and attributes may be intermingled.
  *
  * @param nameCode The name of the attribute, as held in the name pool
  * @param typeCode The type of the attribute, as held in the name pool
  * @param properties Bit significant value. The following bits are defined:
  *     <dd>DISABLE_ESCAPING
  *     <dt>Disable escaping for this attribute
  *     <dd>NO_SPECIAL_CHARACTERS
  *     <dt>Attribute value contains no special characters
  * @throws IllegalStateException: attempt to output an attribute when there is no open element
  *     start tag
  */
 public void attribute(
     int nameCode, int typeCode, CharSequence value, int locationId, int properties)
     throws XPathException {
   super.attribute(nameCode, typeCode, value, locationId, properties);
   if ((nameCode & NamePool.FP_MASK) == StandardNames.XML_ID || isIDCode(typeCode)) {
     if (value.toString().equals(requiredId)) {
       matched = true;
     }
   }
 }
 /** Processing Instruction */
 public void processingInstruction(
     String target, CharSequence data, int locationId, int properties) throws XPathException {
   if (activeDepth > 0) {
     super.processingInstruction(target, data, locationId, properties);
   }
 }
 /** Character data */
 public void characters(CharSequence chars, int locationId, int properties) throws XPathException {
   if (activeDepth > 0) {
     super.characters(chars, locationId, properties);
   }
 }