You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2017/10/06 18:30:20 UTC
svn commit: r1811357 -
/uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java
Author: schor
Date: Fri Oct 6 18:30:20 2017
New Revision: 1811357
URL: http://svn.apache.org/viewvc?rev=1811357&view=rev
Log:
no Jira - slight refactor of xml factory creation, with warnings added
Modified:
uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java
Modified: uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java?rev=1811357&r1=1811356&r2=1811357&view=diff
==============================================================================
--- uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java (original)
+++ uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToXTalk.java Fri Oct 6 18:30:20 2017
@@ -37,16 +37,17 @@ import java.util.ArrayList;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.DefaultHandler;
-
import org.apache.vinci.debug.Debug;
import org.apache.vinci.debug.FatalException;
import org.apache.vinci.transport.ServiceException;
import org.apache.vinci.transport.XTalkTransporter;
import org.apache.vinci.transport.util.XMLConverter;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
/**
* Class for parsing an XML document and converting directly to XTalk.
@@ -215,7 +216,15 @@ public class XMLToXTalk {
XTalkTransporter.writeInt(1, os);
XMLReader xr;
try {
- xr = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ try {
+ spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ } catch (SAXNotRecognizedException e) {
+ System.err.println("Warning: SAXParserFactory didn't recognized feature http://apache.org/xml/features/disallow-doctype-decl");
+ } catch (SAXNotSupportedException e) {
+ System.err.println("Warning: SAXParserFactory doesn't support feature http://apache.org/xml/features/disallow-doctype-decl");
+ }
+ xr = spf.newSAXParser().getXMLReader();
} catch (SAXException e) {
throw new ServiceException("Error creating SAX Parser: " + e);
} catch (ParserConfigurationException e) {