68 import org.xml.sax.ErrorHandler; 69 import org.xml.sax.InputSource; 70 import org.xml.sax.SAXException; 71 import org.xml.sax.SAXNotRecognizedException; 72 import org.xml.sax.SAXNotSupportedException; 73 import org.xml.sax.SAXParseException; 74 import org.xml.sax.XMLReader; 75 76 /** 77 * @author WS Development Team 78 */ 79 public class XmlUtil { 80 81 // not in older JDK, so must be duplicated here, otherwise javax.xml.XMLConstants should be used 82 private static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema"; 83 84 private final static String LEXICAL_HANDLER_PROPERTY = 85 "http://xml.org/sax/properties/lexical-handler"; 86 87 private static final String DISALLOW_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl"; 88 89 private static final String EXTERNAL_GE = "http://xml.org/sax/features/external-general-entities"; 90 91 private static final String EXTERNAL_PE = "http://xml.org/sax/features/external-parameter-entities"; 92 93 private static final String LOAD_EXTERNAL_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; 94 95 private static final Logger LOGGER = Logger.getLogger(XmlUtil.class.getName()); 96 97 private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.ws.disableXmlSecurity"; 98 99 private static boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( 100 new PrivilegedAction<Boolean>() { 101 @Override 102 public Boolean run() { 103 return Boolean.getBoolean(DISABLE_XML_SECURITY); 104 } 105 } 106 ); 107 108 public static String getPrefix(String s) { 109 int i = s.indexOf(':'); 110 if (i == -1) 111 return null; 112 return s.substring(0, i); | 68 import org.xml.sax.ErrorHandler; 69 import org.xml.sax.InputSource; 70 import org.xml.sax.SAXException; 71 import org.xml.sax.SAXNotRecognizedException; 72 import org.xml.sax.SAXNotSupportedException; 73 import org.xml.sax.SAXParseException; 74 import org.xml.sax.XMLReader; 75 76 /** 77 * @author WS Development Team 78 */ 79 public class XmlUtil { 80 81 // not in older JDK, so must be duplicated here, otherwise javax.xml.XMLConstants should be used 82 private static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema"; 83 84 private final static String LEXICAL_HANDLER_PROPERTY = 85 "http://xml.org/sax/properties/lexical-handler"; 86 87 private static final String DISALLOW_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl"; 88 private static final String EXTERNAL_GE = "http://xml.org/sax/features/external-general-entities"; 89 private static final String EXTERNAL_PE = "http://xml.org/sax/features/external-parameter-entities"; 90 private static final String LOAD_EXTERNAL_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; 91 92 private static final Logger LOGGER = Logger.getLogger(XmlUtil.class.getName()); 93 94 private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.ws.disableXmlSecurity"; 95 96 private static boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( 97 new PrivilegedAction<Boolean>() { 98 @Override 99 public Boolean run() { 100 return Boolean.getBoolean(DISABLE_XML_SECURITY); 101 } 102 } 103 ); 104 105 public static String getPrefix(String s) { 106 int i = s.indexOf(':'); 107 if (i == -1) 108 return null; 109 return s.substring(0, i); |