ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1837502 - in /webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema: SchemaBuilder.java XmlSchemaCollection.java utils/DOMUtil.java
Date Mon, 06 Aug 2018 10:53:04 GMT
Author: veithen
Date: Mon Aug  6 10:53:04 2018
New Revision: 1837502

URL: http://svn.apache.org/viewvc?rev=1837502&view=rev
Log:
XMLSCHEMA-53: Drop support for DOM 2.

Modified:
    webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
    webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
    webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java

Modified: webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
URL: http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?rev=1837502&r1=1837501&r2=1837502&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
(original)
+++ webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
Mon Aug  6 10:53:04 2018
@@ -46,7 +46,6 @@ import org.xml.sax.InputSource;
 import org.apache.ws.commons.schema.XmlSchemaCollection.SchemaKey;
 import org.apache.ws.commons.schema.constants.Constants;
 import org.apache.ws.commons.schema.extensions.ExtensionRegistry;
-import org.apache.ws.commons.schema.utils.DOMUtil;
 import org.apache.ws.commons.schema.utils.NodeNamespaceContext;
 import org.apache.ws.commons.schema.utils.TargetNamespaceValidator;
 import org.apache.ws.commons.schema.utils.XDOMUtil;
@@ -155,7 +154,7 @@ public class SchemaBuilder {
     XmlSchema build(Document doc, String uri) {
         Element schemaEl = doc.getDocumentElement();
         XmlSchema xmlSchema = handleXmlSchemaElement(schemaEl, uri);
-        xmlSchema.setInputEncoding(DOMUtil.getInputEncoding(doc));
+        xmlSchema.setInputEncoding(doc.getInputEncoding());
         return xmlSchema;
     }
 

Modified: webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
URL: http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java?rev=1837502&r1=1837501&r2=1837502&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
(original)
+++ webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
Mon Aug  6 10:53:04 2018
@@ -506,7 +506,7 @@ public final class XmlSchemaCollection {
     public XmlSchema read(Document doc, String systemId, TargetNamespaceValidator validator)
{
         SchemaBuilder builder = new SchemaBuilder(this, validator);
         XmlSchema schema = builder.build(doc, systemId);
-        schema.setInputEncoding(DOMUtil.getInputEncoding(doc));
+        schema.setInputEncoding(doc.getInputEncoding());
         return schema;
     }
 
@@ -533,7 +533,7 @@ public final class XmlSchemaCollection {
     public XmlSchema read(Element elem) {
         SchemaBuilder builder = new SchemaBuilder(this, null);
         XmlSchema xmlSchema = builder.handleXmlSchemaElement(elem, null);
-        xmlSchema.setInputEncoding(DOMUtil.getXmlEncoding(elem.getOwnerDocument()));
+        xmlSchema.setInputEncoding(elem.getOwnerDocument().getXmlEncoding());
         return xmlSchema;
     }
 
@@ -548,7 +548,7 @@ public final class XmlSchemaCollection {
     public XmlSchema read(Element elem, String systemId) {
         SchemaBuilder builder = new SchemaBuilder(this, null);
         XmlSchema xmlSchema = builder.handleXmlSchemaElement(elem, systemId);
-        xmlSchema.setInputEncoding(DOMUtil.getInputEncoding(elem.getOwnerDocument()));
+        xmlSchema.setInputEncoding(elem.getOwnerDocument().getInputEncoding());
         return xmlSchema;
     }
 

Modified: webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java
URL: http://svn.apache.org/viewvc/webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java?rev=1837502&r1=1837501&r2=1837502&view=diff
==============================================================================
--- webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java
(original)
+++ webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java
Mon Aug  6 10:53:04 2018
@@ -19,8 +19,6 @@
 
 package org.apache.ws.commons.schema.utils;
 
-import java.lang.reflect.Method;
-
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -36,9 +34,6 @@ import org.w3c.dom.Node;
  * @version $ID DOMUtil
  */
 public class DOMUtil {
-
-    private static final String DEFAULT_ENCODING = "UTF-8";
-
     //
     // Constructors
     //
@@ -560,37 +555,4 @@ public class DOMUtil {
     public static String getNamespaceURI(Node node) {
         return node.getNamespaceURI();
     }
-
-    /**
-     * Get the input encoding of the document. This uses a DOM 3 API call getInputEncoding
hence it returns
-     * the correct value only if a DOM3 API is used. Otherwise it returns the default encoding
-     * 
-     * @param doc
-     * @return the encoding (e.g. UTF-8)
-     */
-    public static String getInputEncoding(Document doc) {
-        try {
-            Method m = doc.getClass().getMethod("getInputEncoding", new Class[] {});
-            return (String)m.invoke(doc, new Object[] {});
-        } catch (Throwable e) {
-            return DEFAULT_ENCODING;
-        }
-    }
-
-    /**
-     * Get the xml encoding of the document. This uses a DOM 3 API call getXmlEncoding hence
it returns the
-     * correct value only if a DOM3 API is used. Otherwise it returns the default encoding
-     * 
-     * @see #getInputEncoding(Document)
-     * @param doc
-     * @return the encoding (e.g. utf-8).
-     */
-    public static String getXmlEncoding(Document doc) {
-        try {
-            Method m = doc.getClass().getMethod("getXmlEncoding", new Class[] {});
-            return (String)m.invoke(doc, new Object[] {});
-        } catch (Throwable e) {
-            return DEFAULT_ENCODING;
-        }
-    }
 }



Mime
View raw message