package jlibs.xml.sax;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import java.io.IOException;

/**
 * @author Santhosh Kumar T
 */
public class XMLWriter extends AbstractXMLReader{
    public XMLWriter(){
        supportedFeatures.add(SAXFeatures.NAMESPACES);
    }

    @Override
    @SuppressWarnings({"unchecked"})
    public void parse(InputSource input) throws IOException, SAXException{
        if(input instanceof ObjectInputSource)
            ((ObjectInputSource)input).writeInto(this);
        else
            throw new IOException("can't parse "+input);
    }

    @Override
    public void parse(String systemId) throws IOException, SAXException{
        throw new UnsupportedOperationException();
    }
}

@@ -83,16 +83,71 @@
 ption;%0A%0A
+import javax.xml.parsers.ParserConfigurationException;%0A
 import j
@@ -166,16 +166,16 @@
 eption;%0A
-
 %0A/**%0A * 
@@ -430,34 +430,35 @@
 e input) throws 
-IO
+SAX
 Exception, SAXEx
@@ -444,35 +444,34 @@
 s SAXException, 
-SAX
+IO
 Exception%7B%0A     
@@ -457,32 +457,49 @@
 n, IOException%7B%0A
+        try%7B%0A    
         if(input
@@ -529,16 +529,20 @@
 Source)%0A
+    
         
@@ -589,16 +589,20 @@
 (this);%0A
+    
         
@@ -610,32 +610,36 @@
 lse%0A            
+    
 throw new IOExce
@@ -667,16 +667,115 @@
 input);%0A
+        %7Dcatch(ParserConfigurationException ex)%7B%0A            throw new SAXException(ex);%0A        %7D%0A
     %7D%0A%0A 

handle ParserConfigurationException thrown by writeInto(...)