Author: ajith
Date: Fri Jun 15 16:43:19 2007
New Revision: 547828
URL: http://svn.apache.org/viewvc?view=rev&rev=547828
Log:
1. Fixing a few minor issues
I. Moved the block of setting the default encoding so that one can override
it by passing a specific policy
II. Fixed a few other places where the input encoding needs to be passed on to
the schema object
Modified:
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
Modified:
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java?view=diff&rev=547828&r1=547827&r2=547828
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java
Fri Jun 15 16:43:19 2007
@@ -252,14 +252,24 @@
try {
trFac.setAttribute("indent-number", "4");
} catch (IllegalArgumentException e) {
-
+ //do nothing - we'll just silently let this pass if it
+ //was not compatible
}
Source source = new DOMSource(serializedSchemas[0]);
Result result = new StreamResult(out);
javax.xml.transform.Transformer tr = trFac.newTransformer();
+ //use the input encoding if there is one one
+ if (schema.inputEncoding!= null &&
+ "".equals(schema.inputEncoding)){
+ tr.setOutputProperty(OutputKeys.ENCODING,schema.inputEncoding);
+ }
+
//let these be configured from outside if any is present
+ //Note that one can enforce the encoding by passing the necessary
+ //property in options
+
if (options==null){
options = new HashMap();
loadDefaultOptions(options);
@@ -269,14 +279,6 @@
Object key = keys.next();
tr.setOutputProperty((String)key, (String)options.get(key));
}
-
-
- //use the input encoding if there is one ava
- if (schema.inputEncoding!= null &&
- "".equals(schema.inputEncoding)){
- tr.setOutputProperty(OutputKeys.ENCODING,schema.inputEncoding);
- }
-
tr.transform(source, result);
out.flush();
Modified:
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java?view=diff&rev=547828&r1=547827&r2=547828
==============================================================================
---
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
(original)
+++
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollection.java
Fri Jun 15 16:43:19 2007
@@ -119,7 +119,7 @@
/**
* Set the base URI. This is used when schemas need to be
* loaded from relative locations
- * @param baseUri
+ * @param baseUri baseUri for this
*/
public void setBaseUri(String baseUri){
this.baseUri = baseUri;
@@ -127,7 +127,7 @@
/**
* Register a custom URI resolver
- * @param schemaResolver
+ * @param schemaResolver resolver
*/
public void setSchemaResolver(URIResolver schemaResolver) {
this.schemaResolver = schemaResolver;
@@ -340,7 +340,9 @@
public XmlSchema read(Element elem) {
SchemaBuilder builder = new SchemaBuilder(this, null);
- return builder.handleXmlSchemaElement(elem, null);
+ XmlSchema xmlSchema = builder.handleXmlSchemaElement(elem, null);
+ xmlSchema.setInputEncoding(elem.getOwnerDocument().getInputEncoding());
+ return xmlSchema;
}
public XmlSchema read(Document doc, String uri, ValidationEventHandler
veh) {
@@ -355,7 +357,9 @@
public XmlSchema read(Element elem, String uri) {
SchemaBuilder builder = new SchemaBuilder(this, null);
- return builder.handleXmlSchemaElement(elem, uri);
+ XmlSchema xmlSchema = builder.handleXmlSchemaElement(elem, null);
+ xmlSchema.setInputEncoding(elem.getOwnerDocument().getInputEncoding());
+ return xmlSchema;
}
/**
@@ -372,7 +376,8 @@
* from schemata with different target namespaces, then it may
* occur, that multiple schema instances with different logical
* target namespaces may be returned.
- * @param systemId
+ * @param systemId the system id for this schema
+ * @return array of XmlSchema objects
*/
public XmlSchema[] getXmlSchema(String systemId) {
if (systemId == null) {
@@ -390,6 +395,7 @@
/**
* Returns an array of all the XmlSchemas in this collection.
+ * @return the list of XmlSchema objects
*/
public XmlSchema[] getXmlSchemas() {
Collection c = schemas.values();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]