Index: PSVIWriter.java
===================================================================
RCS file: /home/cvspublic/xml-xerces/java/samples/xni/PSVIWriter.java,v
retrieving revision 1.20
diff -u -r1.20 PSVIWriter.java
--- PSVIWriter.java	30 Jul 2003 19:22:22 -0000	1.20
+++ PSVIWriter.java	18 Aug 2003 17:39:42 -0000
@@ -705,7 +705,9 @@
         // this isn't relevant to PSVI
         sendElementEvent("allDeclarationsProcessed", "true");
         sendUnIndentedElement("document");
-        fDocumentHandler.endDocument(null);
+        if (fDocumentHandler != null) {
+            fDocumentHandler.endDocument(null);
+        }
     } // endDocument()
 
     /**
@@ -1780,11 +1782,13 @@
 
     private void sendEmptyElementEvent(String tagname, Vector attributes) {
         this.sendIndent();
-        fDocumentHandler.emptyElement(
-            createQName(tagname),
-            createAttributes(attributes),
-            null);
-        this.sendNewLine();
+        if (fDocumentHandler != null) {
+            fDocumentHandler.emptyElement(
+                createQName(tagname),
+                createAttributes(attributes),
+                null);
+            this.sendNewLine();
+        }
     } //sendEmptyElementEvent
 
     /**
@@ -1795,10 +1799,12 @@
      * @throws IOEXception
      */
     private void sendStartElementEvent(String tagname, Vector attributes) {
-        fDocumentHandler.startElement(
-            createQName(tagname),
-            createAttributes(attributes),
-            null);
+        if (fDocumentHandler != null) {
+            fDocumentHandler.startElement(
+                createQName(tagname),
+                createAttributes(attributes),
+                null);
+        }
     } //sendStartElementEvent
 
     /**
@@ -1809,7 +1815,9 @@
      * @throws IOEXception
      */
     private void sendEndElementEvent(String tagname) {
-        fDocumentHandler.endElement(this.createQName(tagname), null);
+        if (fDocumentHandler != null) {
+            fDocumentHandler.endElement(this.createQName(tagname), null);
+        }
     } //sendEndElementEvent
 
     /**
@@ -1897,7 +1905,9 @@
         else {
             this.sendIndent();
             this.sendStartElementEvent(elementName, attributes);
-            fDocumentHandler.characters(elementValue, null);
+            if (fDocumentHandler != null) {
+                fDocumentHandler.characters(elementValue, null);
+            }
             this.sendEndElementEvent(elementName);
             this.sendNewLine();
         }
@@ -1923,11 +1933,15 @@
             }
         }
         XMLString text = new XMLString(fIndentChars, 0, fIndent);
-        fDocumentHandler.characters(text, null);
+        if (fDocumentHandler != null) {
+            fDocumentHandler.characters(text, null);
+        }
     }
 
     private void sendNewLine() {
-        fDocumentHandler.characters(newLine, null);
+        if (fDocumentHandler != null) {
+            fDocumentHandler.characters(newLine, null);
+        }
     }
 
     private QName createQName(String rawname) {
