You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2008/02/28 19:42:41 UTC
svn commit: r632082 - in
/webservices/commons/branches/modules/XmlSchema/1.4: pom.xml
src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java
Author: ajith
Date: Thu Feb 28 10:42:35 2008
New Revision: 632082
URL: http://svn.apache.org/viewvc?rev=632082&view=rev
Log:
1. Changed the version number to 1.4 RC1
2. Fixed the use of DOM 3 API calls from direct calls to reflective calls. Now the methods would be called only if a DOM 3 API is present
Modified:
webservices/commons/branches/modules/XmlSchema/1.4/pom.xml
webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java
Modified: webservices/commons/branches/modules/XmlSchema/1.4/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1.4/pom.xml?rev=632082&r1=632081&r2=632082&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1.4/pom.xml (original)
+++ webservices/commons/branches/modules/XmlSchema/1.4/pom.xml Thu Feb 28 10:42:35 2008
@@ -27,7 +27,7 @@
<artifactId>XmlSchema</artifactId>
<packaging>bundle</packaging>
<name>XmlSchema</name>
- <version>1.3.3-RC3</version>
+ <version>1.4-RC1</version>
<description>Commons XMLSchema is a light weight schema object model that can be used to manipualte or
generate a schema. It has a clean, easy to use API and can easily be integrated into an existing project
since it has almost no dependancies on third party libraries.</description>
Modified: webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java?rev=632082&r1=632081&r2=632082&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java Thu Feb 28 10:42:35 2008
@@ -397,7 +397,7 @@
TargetNamespaceValidator validator) {
SchemaBuilder builder = new SchemaBuilder(this, validator);
XmlSchema schema = builder.build(doc, uri, veh);
- schema.setInputEncoding(doc.getInputEncoding());
+ schema.setInputEncoding(DOMUtil.getInputEncoding(doc));
return schema;
}
Modified: webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java?rev=632082&r1=632081&r2=632082&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1.4/src/main/java/org/apache/ws/commons/schema/utils/DOMUtil.java Thu Feb 28 10:42:35 2008
@@ -36,7 +36,9 @@
*/
public class DOMUtil {
- //
+ private static final String DEFAULT_ENCODING = "UTF-8";
+
+ //
// Constructors
//
@@ -587,22 +589,36 @@
return node.getNamespaceURI();
}
- //why do we need to use reflection here??
+ /**
+ * 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
+ */
public static String getInputEncoding(Document doc) {
try {
Method m = Document.class.getMethod("getInputEncoding", new Class[]{});
return (String) m.invoke(doc, new Object[]{});
} catch (Exception e) {
- return "UTF-8";
+ return DEFAULT_ENCODING;
}
}
- //why do we need to use reflection here??
+ /**
+ * 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
+ */
public static String getXmlEncoding(Document doc) {
try {
- return doc.getXmlEncoding();
+ Method m = Document.class.getMethod("getXmlEncoding", new Class[]{});
+ return (String) m.invoke(doc, new Object[]{});
} catch (Exception e) {
- return "UTF-8";
+ return DEFAULT_ENCODING;
}
}
} // class XUtil
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org