// private methods
 private synchronized void writeToSAX(ContentHandler handler) {
   // nothing must go wrong with this parse...
   SAXParser parser = fGrammar.getSAXParser();
   StringReader aReader = new StringReader(fData);
   InputSource aSource = new InputSource(aReader);
   parser.setContentHandler(handler);
   try {
     parser.parse(aSource);
   } catch (SAXException e) {
     // this should never happen!
     // REVISIT:  what to do with this?; should really not
     // eat it...
   } catch (IOException i) {
     // ditto with above
   }
 }
 // this creates the new Annotation element as the first child
 // of the Node
 private synchronized void writeToDOM(Node target, short type) {
   Document futureOwner =
       (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document) target;
   DOMParser parser = fGrammar.getDOMParser();
   StringReader aReader = new StringReader(fData);
   InputSource aSource = new InputSource(aReader);
   try {
     parser.parse(aSource);
   } catch (SAXException e) {
     // this should never happen!
     // REVISIT:  what to do with this?; should really not
     // eat it...
   } catch (IOException i) {
     // ditto with above
   }
   Document aDocument = parser.getDocument();
   Element annotation = aDocument.getDocumentElement();
   Node newElem = futureOwner.importNode(annotation, true);
   target.insertBefore(newElem, target.getFirstChild());
 }