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 bi...@apache.org on 2008/12/15 00:18:59 UTC
svn commit: r726576 [3/10] - in
/webservices/commons/trunk/modules/XmlSchema: ./ etc/ etc/eclipse/
src/main/java/org/apache/ws/commons/schema/
src/main/java/org/apache/ws/commons/schema/constants/
src/main/java/org/apache/ws/commons/schema/extensions/ ...
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/TypeReceiver.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/TypeReceiver.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/TypeReceiver.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/TypeReceiver.java Sun Dec 14 15:18:54 2008
@@ -20,8 +20,7 @@
package org.apache.ws.commons.schema;
/**
- * A TypeReceiver is something that can have its type set. This gets used
- * to resolve forward references.
+ * A TypeReceiver is something that can have its type set. This gets used to resolve forward references.
*/
public interface TypeReceiver {
void setType(XmlSchemaType type);
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/ValidationEvent.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/ValidationEvent.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/ValidationEvent.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/ValidationEvent.java Sun Dec 14 15:18:54 2008
@@ -26,9 +26,9 @@
/**
*
*/
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- /**
+ /**
* Creates new ValidationEvent
*/
public ValidationEvent(Object source) {
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?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- 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 Sun Dec 14 15:18:54 2008
@@ -46,18 +46,15 @@
// variable to name s.
//Feb 21th - Joni - Port to XMLDomUtil and Tranformation.
/**
- * Contains the definition of a schema. All XML Schema definition language (XSD)
- * elements are children of the schema element. Represents the World Wide Web
- * Consortium (W3C) schema element
+ * Contains the definition of a schema. All XML Schema definition language (XSD) elements are children of the
+ * schema element. Represents the World Wide Web Consortium (W3C) schema element
*/
public class XmlSchema extends XmlSchemaAnnotated implements NamespaceContextOwner {
private static final String UTF_8_ENCODING = "UTF-8";
- static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
+ static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
XmlSchemaForm attributeFormDefault, elementFormDefault;
- XmlSchemaObjectTable attributeGroups,
- attributes, elements, groups,
- notations, schemaTypes;
+ XmlSchemaObjectTable attributeGroups, attributes, elements, groups, notations, schemaTypes;
XmlSchemaDerivationMethod blockDefault, finalDefault;
XmlSchemaObjectCollection includes, items;
boolean isCompiled;
@@ -66,34 +63,36 @@
XmlSchemaCollection parent;
private NamespacePrefixList namespaceContext;
- //keep the encoding of the input
+ // keep the encoding of the input
private String inputEncoding;
- public void setInputEncoding(String encoding){
+ public void setInputEncoding(String encoding) {
this.inputEncoding = encoding;
}
+
/**
- * Creates new XmlSchema
- * Create a new XmlSchema. The schema is <i>not</i> added to the parent collection,
- * since it has no target namespace when created through this constructor.
- * Call {@link XmlSchema#XmlSchema(String, XmlSchemaCollection)} instead.
- *
- * @param parent the parent XmlSchemaCollection
+ * Creates new XmlSchema Create a new XmlSchema. The schema is <i>not</i> added to the parent collection,
+ * since it has no target namespace when created through this constructor. Call
+ * {@link XmlSchema#XmlSchema(String, XmlSchemaCollection)} instead.
+ *
+ * @param parent the parent XmlSchemaCollection
* @deprecated
- */
- public XmlSchema(XmlSchemaCollection parent) {
- this(null, null, parent);
+ */
+ @Deprecated
+ public XmlSchema(XmlSchemaCollection parent) {
+ this(null, null, parent);
}
/**
* Create a schema that is not a member of a collection.
*/
public XmlSchema() {
- this(null, null, null);
+ this(null, null, null);
}
/**
* Create a new schema and record it as a member of a schema collection.
+ *
* @param namespace the target namespace.
* @param systemId the system ID for the schema.
* @param parent the parent collection.
@@ -115,22 +114,23 @@
syntacticalTargetNamespace = logicalTargetNamespace = namespace;
if (logicalTargetNamespace == null) {
- logicalTargetNamespace = "";
- }
- if(parent != null) {
- XmlSchemaCollection.SchemaKey schemaKey =
- new XmlSchemaCollection.SchemaKey(this.logicalTargetNamespace, systemId);
- if (parent.containsSchema(schemaKey)) {
- throw new XmlSchemaException("Schema name conflict in collection");
- } else {
- parent.addSchema(schemaKey, this);
- }
+ logicalTargetNamespace = "";
+ }
+ if (parent != null) {
+ XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey(
+ this.logicalTargetNamespace,
+ systemId);
+ if (parent.containsSchema(schemaKey)) {
+ throw new XmlSchemaException("Schema name conflict in collection");
+ } else {
+ parent.addSchema(schemaKey, this);
+ }
}
}
public XmlSchema(String namespace, XmlSchemaCollection parent) {
this(namespace, namespace, parent);
-
+
}
public XmlSchemaForm getAttributeFormDefault() {
@@ -169,204 +169,193 @@
return elements;
}
-
- protected XmlSchemaElement getElementByName(QName name, boolean deep,
- Stack schemaStack) {
- if (schemaStack != null && schemaStack.contains(this)) {
- // recursive schema - just return null
- return null;
- } else {
- XmlSchemaElement element = (XmlSchemaElement) elements
- .getItem(name);
- if (deep) {
- if (element == null) {
- // search the imports
- for (Iterator includedItems = includes.getIterator(); includedItems
- .hasNext();) {
-
- XmlSchema schema = getSchema(includedItems.next());
-
- if (schema != null) {
- // create an empty stack - push the current parent in
- // and
- // use the protected method to process the schema
- if (schemaStack == null) {
- schemaStack = new Stack();
- }
- schemaStack.push(this);
- element = schema.getElementByName(name, deep,
- schemaStack);
- if (element != null) {
- return element;
- }
- }
- }
- } else {
- return element;
- }
- }
-
- return element;
- }
- }
-
+ protected XmlSchemaElement getElementByName(QName name, boolean deep, Stack schemaStack) {
+ if (schemaStack != null && schemaStack.contains(this)) {
+ // recursive schema - just return null
+ return null;
+ } else {
+ XmlSchemaElement element = (XmlSchemaElement)elements.getItem(name);
+ if (deep) {
+ if (element == null) {
+ // search the imports
+ for (Iterator includedItems = includes.getIterator(); includedItems.hasNext();) {
+
+ XmlSchema schema = getSchema(includedItems.next());
+
+ if (schema != null) {
+ // create an empty stack - push the current parent in
+ // and
+ // use the protected method to process the schema
+ if (schemaStack == null) {
+ schemaStack = new Stack();
+ }
+ schemaStack.push(this);
+ element = schema.getElementByName(name, deep, schemaStack);
+ if (element != null) {
+ return element;
+ }
+ }
+ }
+ } else {
+ return element;
+ }
+ }
+
+ return element;
+ }
+ }
+
protected XmlSchemaAttribute getAttributeByName(QName name, boolean deep, Stack schemaStack) {
- if (schemaStack != null && schemaStack.contains(this)) {
- // recursive schema - just return null
- return null;
- } else {
- XmlSchemaAttribute attribute = (XmlSchemaAttribute) attributes
- .getItem(name);
- if (deep) {
- if (attribute == null) {
- // search the imports
- for (Iterator includedItems = includes.getIterator(); includedItems
- .hasNext();) {
-
- XmlSchema schema = getSchema(includedItems.next());
-
- if (schema != null) {
- // create an empty stack - push the current parent in
- // and
- // use the protected method to process the schema
- if (schemaStack == null) {
- schemaStack = new Stack();
- }
- schemaStack.push(this);
- attribute = schema.getAttributeByName(name, deep,
- schemaStack);
- if (attribute != null) {
- return attribute;
- }
- }
- }
- } else {
- return attribute;
- }
- }
-
- return attribute;
- }
- }
-
- /**
- * get an element by the name in the local schema
- *
- * @param name
- * @return the element.
- */
- public XmlSchemaElement getElementByName(String name) {
- QName nameToSearchFor = new QName(this.getTargetNamespace(),name);
+ if (schemaStack != null && schemaStack.contains(this)) {
+ // recursive schema - just return null
+ return null;
+ } else {
+ XmlSchemaAttribute attribute = (XmlSchemaAttribute)attributes.getItem(name);
+ if (deep) {
+ if (attribute == null) {
+ // search the imports
+ for (Iterator includedItems = includes.getIterator(); includedItems.hasNext();) {
+
+ XmlSchema schema = getSchema(includedItems.next());
+
+ if (schema != null) {
+ // create an empty stack - push the current parent in
+ // and
+ // use the protected method to process the schema
+ if (schemaStack == null) {
+ schemaStack = new Stack();
+ }
+ schemaStack.push(this);
+ attribute = schema.getAttributeByName(name, deep, schemaStack);
+ if (attribute != null) {
+ return attribute;
+ }
+ }
+ }
+ } else {
+ return attribute;
+ }
+ }
+
+ return attribute;
+ }
+ }
+
+ /**
+ * get an element by the name in the local schema
+ *
+ * @param name
+ * @return the element.
+ */
+ public XmlSchemaElement getElementByName(String name) {
+ QName nameToSearchFor = new QName(this.getTargetNamespace(), name);
return this.getElementByName(nameToSearchFor, false, null);
- }
+ }
- /**
- * Look for a element by its qname. Searches through all the schemas
- * @param name
- * @return the element.
- */
- public XmlSchemaElement getElementByName(QName name) {
- return this.getElementByName(name, true, null);
- }
-
- /**
- * Look for a global attribute by its QName. Searches through all schemas.
- * @param name
- * @return the attribute.
- */
- public XmlSchemaAttribute getAttributeByName(QName name) {
- return this.getAttributeByName(name, true, null);
- }
-
- /**
- * Protected method that allows safe (non-recursive schema loading). It looks for a type
- * with constraints.
- *
- * @param name
- * @param deep
- * @param schemaStack
- * @return the type.
- */
- protected XmlSchemaType getTypeByName(QName name, boolean deep,
- Stack schemaStack) {
- if (schemaStack != null && schemaStack.contains(this)) {
- // recursive schema - just return null
- return null;
- } else {
- XmlSchemaType type = (XmlSchemaType) schemaTypes.getItem(name);
-
- if (deep) {
- if (type == null) {
- // search the imports
- for (Iterator includedItems = includes.getIterator(); includedItems
- .hasNext();) {
-
- XmlSchema schema = getSchema(includedItems.next());
-
- if (schema != null) {
- // create an empty stack - push the current parent
- // use the protected method to process the schema
- if (schemaStack == null) {
- schemaStack = new Stack();
- }
- schemaStack.push(this);
- type = schema
- .getTypeByName(name, deep, schemaStack);
- if (type != null) {
- return type;
- }
- }
- }
- } else {
- return type;
- }
- }
-
- return type;
- }
- }
-
- /**
- * Search this schema and all the imported/included ones
- * for the given Qname
- * @param name
- * @return the type.
- */
- public XmlSchemaType getTypeByName(QName name) {
- return getTypeByName(name, true, null);
- }
-
- /**
- * Search this schema for a type by qname.
- * @param name
- * @return the type.
- */
- public XmlSchemaType getTypeByName(String name) {
- QName nameToSearchFor = new QName(this.getTargetNamespace(),name);
- return getTypeByName(nameToSearchFor, false, null);
- }
+ /**
+ * Look for a element by its qname. Searches through all the schemas
+ *
+ * @param name
+ * @return the element.
+ */
+ public XmlSchemaElement getElementByName(QName name) {
+ return this.getElementByName(name, true, null);
+ }
+
+ /**
+ * Look for a global attribute by its QName. Searches through all schemas.
+ *
+ * @param name
+ * @return the attribute.
+ */
+ public XmlSchemaAttribute getAttributeByName(QName name) {
+ return this.getAttributeByName(name, true, null);
+ }
+
+ /**
+ * Protected method that allows safe (non-recursive schema loading). It looks for a type with constraints.
+ *
+ * @param name
+ * @param deep
+ * @param schemaStack
+ * @return the type.
+ */
+ protected XmlSchemaType getTypeByName(QName name, boolean deep, Stack schemaStack) {
+ if (schemaStack != null && schemaStack.contains(this)) {
+ // recursive schema - just return null
+ return null;
+ } else {
+ XmlSchemaType type = (XmlSchemaType)schemaTypes.getItem(name);
+
+ if (deep) {
+ if (type == null) {
+ // search the imports
+ for (Iterator includedItems = includes.getIterator(); includedItems.hasNext();) {
+
+ XmlSchema schema = getSchema(includedItems.next());
+
+ if (schema != null) {
+ // create an empty stack - push the current parent
+ // use the protected method to process the schema
+ if (schemaStack == null) {
+ schemaStack = new Stack();
+ }
+ schemaStack.push(this);
+ type = schema.getTypeByName(name, deep, schemaStack);
+ if (type != null) {
+ return type;
+ }
+ }
+ }
+ } else {
+ return type;
+ }
+ }
- /**
- * Get a schema from an import
- *
- * @param includeOrImport
- * @return return the schema object.
- */
- private XmlSchema getSchema(Object includeOrImport) {
- XmlSchema schema;
- if (includeOrImport instanceof XmlSchemaImport) {
- schema = ((XmlSchemaImport) includeOrImport).getSchema();
- } else if (includeOrImport instanceof XmlSchemaInclude) {
- schema = ((XmlSchemaInclude) includeOrImport).getSchema();
- } else {
- // skip ?
- schema = null;
- }
+ return type;
+ }
+ }
+
+ /**
+ * Search this schema and all the imported/included ones for the given Qname
+ *
+ * @param name
+ * @return the type.
+ */
+ public XmlSchemaType getTypeByName(QName name) {
+ return getTypeByName(name, true, null);
+ }
+
+ /**
+ * Search this schema for a type by qname.
+ *
+ * @param name
+ * @return the type.
+ */
+ public XmlSchemaType getTypeByName(String name) {
+ QName nameToSearchFor = new QName(this.getTargetNamespace(), name);
+ return getTypeByName(nameToSearchFor, false, null);
+ }
- return schema;
- }
+ /**
+ * Get a schema from an import
+ *
+ * @param includeOrImport
+ * @return return the schema object.
+ */
+ private XmlSchema getSchema(Object includeOrImport) {
+ XmlSchema schema;
+ if (includeOrImport instanceof XmlSchemaImport) {
+ schema = ((XmlSchemaImport)includeOrImport).getSchema();
+ } else if (includeOrImport instanceof XmlSchemaInclude) {
+ schema = ((XmlSchemaInclude)includeOrImport).getSchema();
+ } else {
+ // skip ?
+ schema = null;
+ }
-
+ return schema;
+ }
public XmlSchemaDerivationMethod getFinalDefault() {
return finalDefault;
@@ -420,39 +409,39 @@
/**
* Serialize the schema into the given output stream
+ *
* @param out - the output stream to write to
*/
public void write(OutputStream out) {
- try {
- if (this.inputEncoding!= null &&
- !"".equals(this.inputEncoding)){
- write(new OutputStreamWriter(out,this.inputEncoding));
- }else{
- //As per the XML spec the default is taken to be UTF 8
- write(new OutputStreamWriter(out,UTF_8_ENCODING));
- }
- } catch (UnsupportedEncodingException e) {
- //log the error and just write it without the encoding
- write(new OutputStreamWriter(out));
- }
+ try {
+ if (this.inputEncoding != null && !"".equals(this.inputEncoding)) {
+ write(new OutputStreamWriter(out, this.inputEncoding));
+ } else {
+ // As per the XML spec the default is taken to be UTF 8
+ write(new OutputStreamWriter(out, UTF_8_ENCODING));
+ }
+ } catch (UnsupportedEncodingException e) {
+ // log the error and just write it without the encoding
+ write(new OutputStreamWriter(out));
+ }
}
/**
* Serialize the schema into the given output stream
+ *
* @param out - the output stream to write to
- * @param options - a map of options
+ * @param options - a map of options
*/
public void write(OutputStream out, Map options) {
- try {
- if (this.inputEncoding!= null &&
- !"".equals(this.inputEncoding)){
- write(new OutputStreamWriter(out,this.inputEncoding),options);
- }else{
- write(new OutputStreamWriter(out,UTF_8_ENCODING),options);
- }
- } catch (UnsupportedEncodingException e) {
- //log the error and just write it without the encoding
+ try {
+ if (this.inputEncoding != null && !"".equals(this.inputEncoding)) {
+ write(new OutputStreamWriter(out, this.inputEncoding), options);
+ } else {
+ write(new OutputStreamWriter(out, UTF_8_ENCODING), options);
+ }
+ } catch (UnsupportedEncodingException e) {
+ // log the error and just write it without the encoding
write(new OutputStreamWriter(out));
}
@@ -460,17 +449,20 @@
/**
* Serialie the schema to a given writer
+ *
* @param writer - the writer to write this
*/
- public void write(Writer writer,Map options) {
- serialize_internal(this, writer,options);
+ public void write(Writer writer, Map options) {
+ serialize_internal(this, writer, options);
}
+
/**
* Serialie the schema to a given writer
+ *
* @param writer - the writer to write this
*/
public void write(Writer writer) {
- serialize_internal(this, writer,null);
+ serialize_internal(this, writer, null);
}
public Document[] getAllSchemas() {
@@ -487,11 +479,12 @@
/**
* serialize the schema - this is the method tht does to work
+ *
* @param schema
* @param out
* @param options
*/
- private void serialize_internal(XmlSchema schema, Writer out, Map options) {
+ private void serialize_internal(XmlSchema schema, Writer out, Map options) {
try {
XmlSchemaSerializer xser = new XmlSchemaSerializer();
@@ -502,25 +495,24 @@
try {
trFac.setAttribute("indent-number", "4");
} catch (IllegalArgumentException e) {
- //do nothing - we'll just silently let this pass if it
- //was not compatible
+ // 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
- if (schema.inputEncoding!= null &&
- !"".equals(schema.inputEncoding)){
- tr.setOutputProperty(OutputKeys.ENCODING,schema.inputEncoding);
+ // use the input encoding if there is 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
+ // 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){
+ if (options == null) {
options = new HashMap();
loadDefaultOptions(options);
}
@@ -545,7 +537,8 @@
/**
* Load the default options
- * @param options - the map of
+ *
+ * @param options - the map of
*/
private void loadDefaultOptions(Map options) {
options.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
@@ -555,9 +548,8 @@
public void addType(XmlSchemaType type) {
QName qname = type.getQName();
if (schemaTypes.contains(qname)) {
- throw new XmlSchemaException(" Schema for namespace '" +
- syntacticalTargetNamespace + "' already contains type '" +
- qname.getLocalPart() + "'");
+ throw new XmlSchemaException(" Schema for namespace '" + syntacticalTargetNamespace
+ + "' already contains type '" + qname.getLocalPart() + "'");
}
schemaTypes.add(qname, type);
}
@@ -567,31 +559,31 @@
}
/**
- * Sets the schema elements namespace context. This may be used for schema
- * serialization, until a better mechanism was found.
+ * Sets the schema elements namespace context. This may be used for schema serialization, until a better
+ * mechanism was found.
*/
public void setNamespaceContext(NamespacePrefixList namespaceContext) {
this.namespaceContext = namespaceContext;
}
/**
- * Override the equals(Object) method with equivalence checking
- * that is specific to this class.
+ * Override the equals(Object) method with equivalence checking that is specific to this class.
*/
public boolean equals(Object what) {
- //Note: this method may no longer be required when line number/position are used correctly in XmlSchemaObject.
- //Currently they are simply initialized to zero, but they are used in XmlSchemaObject.equals
- //which can result in a false positive (e.g. if a WSDL contains 2 inlined schemas).
+ // Note: this method may no longer be required when line number/position are used correctly in
+ // XmlSchemaObject.
+ // Currently they are simply initialized to zero, but they are used in XmlSchemaObject.equals
+ // which can result in a false positive (e.g. if a WSDL contains 2 inlined schemas).
if (what == this) {
return true;
}
- //If the inherited behaviour determines that the objects are NOT equal, return false.
- //Otherwise, do some further equivalence checking.
+ // If the inherited behaviour determines that the objects are NOT equal, return false.
+ // Otherwise, do some further equivalence checking.
- if(!super.equals(what)) {
+ if (!super.equals(what)) {
return false;
}
@@ -599,7 +591,7 @@
return false;
}
- XmlSchema xs = (XmlSchema) what;
+ XmlSchema xs = (XmlSchema)what;
if (this.id != null) {
if (!this.id.equals(xs.id)) {
@@ -621,14 +613,14 @@
}
}
- //TODO decide if further schema content should be checked for equivalence.
+ // TODO decide if further schema content should be checked for equivalence.
return true;
}
-
+
/**
- * Retrieve a DOM tree for this one schema, independent of any included or
- * related schemas.
+ * Retrieve a DOM tree for this one schema, independent of any included or related schemas.
+ *
* @return The DOM document.
* @throws XmlSchemaSerializerException
*/
@@ -637,11 +629,11 @@
xser.setExtReg(this.parent.getExtReg());
return xser.serializeSchema(this, false)[0];
}
-
+
public String getInputEncoding() {
return inputEncoding;
}
-
+
public String toString() {
return super.toString() + "[" + logicalTargetNamespace + "]";
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAll.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAll.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAll.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAll.java Sun Dec 14 15:18:54 2008
@@ -20,9 +20,8 @@
package org.apache.ws.commons.schema;
/**
- * Permits the elements in the group to appear (or not appear)
- * in any order in the containing element. Represents the World
- * Wide Web Consortium (W3C) all element (compositor).
+ * Permits the elements in the group to appear (or not appear) in any order in the containing element.
+ * Represents the World Wide Web Consortium (W3C) all element (compositor).
*/
public class XmlSchemaAll extends XmlSchemaGroupBase {
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnnotated.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnnotated.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnnotated.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnnotated.java Sun Dec 14 15:18:54 2008
@@ -27,9 +27,7 @@
public class XmlSchemaAnnotated extends XmlSchemaObject {
/**
- * Defines an annotation.
- * Creates an annotation element.
- * Represents the W3C annotation element.
+ * Defines an annotation. Creates an annotation element. Represents the W3C annotation element.
*/
XmlSchemaAnnotation annotation;
String id;
@@ -37,7 +35,6 @@
// Stores qualified attributes that do not belong to the schema target namespace.
public Attr[] unhandledAttributes;
-
/**
* Creates new XmlSchemaAnnotated
*/
@@ -67,13 +64,13 @@
public void setUnhandledAttributes(Attr[] unhandledAttributes) {
this.unhandledAttributes = unhandledAttributes;
}
-
+
public String toString() {
- if (id == null)
- return super.toString();
- else
- return super.toString() + " [id:" + id + "]";
+ if (id == null) {
+ return super.toString();
+ } else {
+ return super.toString() + " [id:" + id + "]";
+ }
}
}
-
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnnotation.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnnotation.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnnotation.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnnotation.java Sun Dec 14 15:18:54 2008
@@ -19,10 +19,8 @@
package org.apache.ws.commons.schema;
-
/**
- * Defines an annotation. Represents the World Wide Web Consortium (W3C)
- * annotation element.
+ * Defines an annotation. Represents the World Wide Web Consortium (W3C) annotation element.
*/
public class XmlSchemaAnnotation extends XmlSchemaObject {
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java Sun Dec 14 15:18:54 2008
@@ -22,9 +22,8 @@
import org.apache.ws.commons.schema.constants.Constants;
/**
- * Enables any element from the specified namespace or namespaces
- * to appear in the containing complexType element. Represents the
- * World Wide Web Consortium (W3C) any element.
+ * Enables any element from the specified namespace or namespaces to appear in the containing complexType
+ * element. Represents the World Wide Web Consortium (W3C) any element.
*/
public class XmlSchemaAny extends XmlSchemaParticle {
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java Sun Dec 14 15:18:54 2008
@@ -22,9 +22,8 @@
import org.apache.ws.commons.schema.constants.Constants;
/**
- * Enables any attribute from the specified namespace or namespaces
- * to appear in the containing complexType element. Represents the
- * World Wide Web Consortium (W3C) anyAttribute element.
+ * Enables any attribute from the specified namespace or namespaces to appear in the containing complexType
+ * element. Represents the World Wide Web Consortium (W3C) anyAttribute element.
*/
public class XmlSchemaAnyAttribute extends XmlSchemaAnnotated {
@@ -32,8 +31,7 @@
* Creates new XmlSchemaAnyAttribute
*/
public XmlSchemaAnyAttribute() {
- processContent = new XmlSchemaContentProcessing(
- Constants.BlockConstants.NONE);
+ processContent = new XmlSchemaContentProcessing(Constants.BlockConstants.NONE);
}
String namespace;
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAppInfo.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAppInfo.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAppInfo.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAppInfo.java Sun Dec 14 15:18:54 2008
@@ -22,13 +22,12 @@
import org.w3c.dom.NodeList;
/**
- * Defines application specific information within an annotation.
- * Represents the World Wide Web Consortium (W3C) appinfo element.
+ * Defines application specific information within an annotation. Represents the World Wide Web Consortium
+ * (W3C) appinfo element.
*/
// Jan 24 2002 - Joni - Change the Node into NodeList
-
public class XmlSchemaAppInfo extends XmlSchemaObject {
/**
@@ -42,8 +41,7 @@
NodeList markup;
/**
- * Creates new XmlSchemaAppInfo
- * The default constructor initializes all fields to their default values.
+ * Creates new XmlSchemaAppInfo The default constructor initializes all fields to their default values.
*/
public XmlSchemaAppInfo() {
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java Sun Dec 14 15:18:54 2008
@@ -24,12 +24,10 @@
import javax.xml.namespace.QName;
/**
- * Class for attribute types. Represents the World Wide Web Consortium
- * (W3C) attribute element.
+ * Class for attribute types. Represents the World Wide Web Consortium (W3C) attribute element.
*/
// October 15th - momo - initial implementation
-
public class XmlSchemaAttribute extends XmlSchemaAnnotated {
Object attributeType;
@@ -126,11 +124,13 @@
public String toString(String prefix, int tab) {
String xml = new String();
- if (!prefix.equals("") && prefix.indexOf(":") == -1)
+ if (!prefix.equals("") && prefix.indexOf(":") == -1) {
prefix += ":";
+ }
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
+ }
xml += "<" + prefix + "attribute name=\"" + name + "\" type=\"" + schemaTypeName + "\"/>\n";
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java Sun Dec 14 15:18:54 2008
@@ -22,10 +22,8 @@
import javax.xml.namespace.QName;
/**
- * Class for attribute groups. Groups a set of attribute declarations
- * so that they can be incorporated as a group into complex type
- * definitions. Represents the World Wide Web Consortium (W3C)
- * attributeGroup element.
+ * Class for attribute groups. Groups a set of attribute declarations so that they can be incorporated as a
+ * group into complex type definitions. Represents the World Wide Web Consortium (W3C) attributeGroup element.
*/
public class XmlSchemaAttributeGroup extends XmlSchemaAnnotated {
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java Sun Dec 14 15:18:54 2008
@@ -21,10 +21,9 @@
import javax.xml.namespace.QName;
-
/**
- * Class for the attribute group reference. Represents the World Wide
- * Web Consortium (W3C) attributeGroup element with the ref attribute.
+ * Class for the attribute group reference. Represents the World Wide Web Consortium (W3C) attributeGroup
+ * element with the ref attribute.
*/
public class XmlSchemaAttributeGroupRef extends XmlSchemaAnnotated {
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaChoice.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaChoice.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaChoice.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaChoice.java Sun Dec 14 15:18:54 2008
@@ -20,8 +20,8 @@
package org.apache.ws.commons.schema;
/**
- * Allows only one of its children to appear in an instance. Represents
- * the World Wide Web Consortium (W3C) choice (compositor) element.
+ * Allows only one of its children to appear in an instance. Represents the World Wide Web Consortium (W3C)
+ * choice (compositor) element.
*/
public class XmlSchemaChoice extends XmlSchemaGroupBase {
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?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- 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 Sun Dec 14 15:18:54 2008
@@ -56,7 +56,6 @@
/**
* Contains a cache of XML Schema definition language (XSD).
- *
*/
public final class XmlSchemaCollection {
@@ -72,64 +71,70 @@
}
/**
- * This map contains a list of Schema objects keyed in by their namespaces
- * When resolving schemas, this map will be checked for the presence of the schema
- * first
+ * This map contains a list of Schema objects keyed in by their namespaces When resolving schemas, this
+ * map will be checked for the presence of the schema first
*/
private Map knownNamespaceMap = new HashMap();
/**
* get the namespace map
+ *
* @return a map of previously known XMLSchema objects keyed by their namespace (String)
*/
public Map getKnownNamespaceMap() {
- return knownNamespaceMap;
- }
+ return knownNamespaceMap;
+ }
/**
* sets the known namespace map
+ *
* @param knownNamespaceMap a map of previously known XMLSchema objects keyed by their namespace (String)
*/
- public void setKnownNamespaceMap(Map knownNamespaceMap) {
- this.knownNamespaceMap = knownNamespaceMap;
- }
-
-
- /**
- * Key that identifies a schema in a collection, composed of a targetNamespace
- * and a system ID.
- */
+ public void setKnownNamespaceMap(Map knownNamespaceMap) {
+ this.knownNamespaceMap = knownNamespaceMap;
+ }
+
+ /**
+ * Key that identifies a schema in a collection, composed of a targetNamespace and a system ID.
+ */
public static class SchemaKey {
private final String namespace;
private final String systemId;
+
SchemaKey(String pNamespace, String pSystemId) {
namespace = pNamespace == null ? Constants.NULL_NS_URI : pNamespace;
systemId = pSystemId == null ? "" : pSystemId;
}
-
- String getNamespace() { return namespace; }
-
- String getSystemId() { return systemId; }
-
+
+ String getNamespace() {
+ return namespace;
+ }
+
+ String getSystemId() {
+ return systemId;
+ }
+
public int hashCode() {
final int PRIME = 31;
return (PRIME + namespace.hashCode()) * PRIME + systemId.hashCode();
}
-
+
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
- final SchemaKey other = (SchemaKey) obj;
- return namespace.equals(other.namespace) && systemId.equals(other.systemId);
+ }
+ final SchemaKey other = (SchemaKey)obj;
+ return namespace.equals(other.namespace) && systemId.equals(other.systemId);
}
-
+
public String toString() {
- return Constants.NULL_NS_URI.equals(namespace) ?
- systemId : ("{" + namespace + "}" + systemId);
+ return Constants.NULL_NS_URI.equals(namespace) ? systemId : "{" + namespace + "}" + systemId;
}
}
@@ -138,10 +143,8 @@
*/
private Map schemas = new HashMap();
-
/**
- * base URI is used as the base for loading the
- * imports
+ * base URI is used as the base for loading the imports
*/
String baseUri = null;
/**
@@ -150,12 +153,11 @@
private NamespacePrefixList namespaceContext;
/**
- * An org.xml.sax.EntityResolver that is used to
- * resolve the imports/includes
+ * An org.xml.sax.EntityResolver that is used to resolve the imports/includes
*/
private URIResolver schemaResolver = new DefaultURIResolver();
- XmlSchema xsd = new XmlSchema(XmlSchema.SCHEMA_NS, this);
+ XmlSchema xsd = new XmlSchema(XmlSchema.SCHEMA_NS, this);
/**
* stack to track imports (to prevent recursion)
@@ -163,22 +165,22 @@
Stack stack = new Stack();
/**
- * Set the base URI. This is used when schemas need to be
- * loaded from relative locations
- * @param baseUri baseUri for this collection.
+ * Set the base URI. This is used when schemas need to be loaded from relative locations
+ *
+ * @param baseUri baseUri for this collection.
*/
public void setBaseUri(String baseUri) {
this.baseUri = baseUri;
- if(schemaResolver instanceof CollectionURIResolver) {
- CollectionURIResolver resolverWithBase =
- (CollectionURIResolver) schemaResolver;
- resolverWithBase.setCollectionBaseURI(baseUri);
+ if (schemaResolver instanceof CollectionURIResolver) {
+ CollectionURIResolver resolverWithBase = (CollectionURIResolver)schemaResolver;
+ resolverWithBase.setCollectionBaseURI(baseUri);
}
}
/**
* Register a custom URI resolver
- * @param schemaResolver resolver
+ *
+ * @param schemaResolver resolver
*/
public void setSchemaResolver(URIResolver schemaResolver) {
this.schemaResolver = schemaResolver;
@@ -186,49 +188,32 @@
/**
* Retrieve the custom URI resolver, if any.
+ *
* @return the current resolver.
*/
public URIResolver getSchemaResolver() {
- return schemaResolver;
- }
+ return schemaResolver;
+ }
/**
- * This section should comply to the XMLSchema specification; see
- * <a href="http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes">
- * http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes</a>.
- * This needs to be inspected by another pair of eyes
+ * This section should comply to the XMLSchema specification; see <a
+ * href="http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes">
+ * http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes</a>. This needs to
+ * be inspected by another pair of eyes
*/
public void init() {
-
- /*
- * Defined in section 4.
- */
- addSimpleType(xsd, Constants.XSD_ANYSIMPLETYPE.getLocalPart());
- addSimpleType(xsd, Constants.XSD_ANYTYPE.getLocalPart());
-
+
/*
- Primitive types
+ * Defined in section 4.
+ */
+ addSimpleType(xsd, Constants.XSD_ANYSIMPLETYPE.getLocalPart());
+ addSimpleType(xsd, Constants.XSD_ANYTYPE.getLocalPart());
- 3.2.1 string
- 3.2.2 boolean
- 3.2.3 decimal
- 3.2.4 float
- 3.2.5 double
- 3.2.6 duration
- 3.2.7 dateTime
- 3.2.8 time
- 3.2.9 date
- 3.2.10 gYearMonth
- 3.2.11 gYear
- 3.2.12 gMonthDay
- 3.2.13 gDay
- 3.2.14 gMonth
- 3.2.15 hexBinary
- 3.2.16 base64Binary
- 3.2.17 anyURI
- 3.2.18 QName
- 3.2.19 NOTATION
- */
+ /*
+ * Primitive types 3.2.1 string 3.2.2 boolean 3.2.3 decimal 3.2.4 float 3.2.5 double 3.2.6 duration
+ * 3.2.7 dateTime 3.2.8 time 3.2.9 date 3.2.10 gYearMonth 3.2.11 gYear 3.2.12 gMonthDay 3.2.13 gDay
+ * 3.2.14 gMonth 3.2.15 hexBinary 3.2.16 base64Binary 3.2.17 anyURI 3.2.18 QName 3.2.19 NOTATION
+ */
addSimpleType(xsd, Constants.XSD_STRING.getLocalPart());
addSimpleType(xsd, Constants.XSD_BOOLEAN.getLocalPart());
addSimpleType(xsd, Constants.XSD_FLOAT.getLocalPart());
@@ -249,36 +234,15 @@
addSimpleType(xsd, Constants.XSD_BASE64.getLocalPart());
addSimpleType(xsd, Constants.XSD_ANYURI.getLocalPart());
-
/*
- 3.3.1 normalizedString
- 3.3.2 token
- 3.3.3 language
- 3.3.4 NMTOKEN
- 3.3.5 NMTOKENS
- 3.3.6 Name
- 3.3.7 NCName
- 3.3.8 ID
- 3.3.9 IDREF
- 3.3.10 IDREFS
- 3.3.11 ENTITY
- 3.3.12 ENTITIES
- 3.3.13 integer
- 3.3.14 nonPositiveInteger
- 3.3.15 negativeInteger
- 3.3.16 long
- 3.3.17 int
- 3.3.18 short
- 3.3.19 byte
- 3.3.20 nonNegativeInteger
- 3.3.21 unsignedLong
- 3.3.22 unsignedInt
- 3.3.23 unsignedShort
- 3.3.24 unsignedByte
- 3.3.25 positiveInteger
- */
+ * 3.3.1 normalizedString 3.3.2 token 3.3.3 language 3.3.4 NMTOKEN 3.3.5 NMTOKENS 3.3.6 Name 3.3.7
+ * NCName 3.3.8 ID 3.3.9 IDREF 3.3.10 IDREFS 3.3.11 ENTITY 3.3.12 ENTITIES 3.3.13 integer 3.3.14
+ * nonPositiveInteger 3.3.15 negativeInteger 3.3.16 long 3.3.17 int 3.3.18 short 3.3.19 byte 3.3.20
+ * nonNegativeInteger 3.3.21 unsignedLong 3.3.22 unsignedInt 3.3.23 unsignedShort 3.3.24 unsignedByte
+ * 3.3.25 positiveInteger
+ */
- //derived types from decimal
+ // derived types from decimal
addSimpleType(xsd, Constants.XSD_LONG.getLocalPart());
addSimpleType(xsd, Constants.XSD_SHORT.getLocalPart());
addSimpleType(xsd, Constants.XSD_BYTE.getLocalPart());
@@ -293,7 +257,7 @@
addSimpleType(xsd, Constants.XSD_UNSIGNEDLONG.getLocalPart());
addSimpleType(xsd, Constants.XSD_UNSIGNEDSHORT.getLocalPart());
- //derived types from string
+ // derived types from string
addSimpleType(xsd, Constants.XSD_NAME.getLocalPart());
addSimpleType(xsd, Constants.XSD_NORMALIZEDSTRING.getLocalPart());
addSimpleType(xsd, Constants.XSD_NCNAME.getLocalPart());
@@ -307,17 +271,18 @@
addSimpleType(xsd, Constants.XSD_LANGUAGE.getLocalPart());
addSimpleType(xsd, Constants.XSD_TOKEN.getLocalPart());
- //SchemaKey key = new SchemaKey(XmlSchema.SCHEMA_NS, null);
- //addSchema(key, xsd);
+ // SchemaKey key = new SchemaKey(XmlSchema.SCHEMA_NS, null);
+ // addSchema(key, xsd);
// look for a system property to see whether we have a registered
// extension registry class. if so we'll instantiate a new one
// and set it as the extension registry
- //if there is an error, we'll just print out a message and move on.
+ // if there is an error, we'll just print out a message and move on.
- if (System.getProperty(Constants.SystemConstants.EXTENSION_REGISTRY_KEY)!= null){
+ if (System.getProperty(Constants.SystemConstants.EXTENSION_REGISTRY_KEY) != null) {
try {
- Class clazz = Class.forName(System.getProperty(Constants.SystemConstants.EXTENSION_REGISTRY_KEY));
+ Class clazz = Class.forName(System
+ .getProperty(Constants.SystemConstants.EXTENSION_REGISTRY_KEY));
this.extReg = (ExtensionRegistry)clazz.newInstance();
} catch (ClassNotFoundException e) {
System.err.println("The specified extension registry class cannot be found!");
@@ -333,46 +298,47 @@
return schemas.containsKey(pKey);
}
-
/**
* gets a schema from the external namespace map
+ *
* @param namespace
* @return
*/
XmlSchema getKnownSchema(String namespace) {
- return (XmlSchema) knownNamespaceMap.get(namespace);
+ return (XmlSchema)knownNamespaceMap.get(namespace);
}
-
+
/**
* Get a schema given a SchemaKey
+ *
* @param pKey
* @return
*/
XmlSchema getSchema(SchemaKey pKey) {
- return (XmlSchema) schemas.get(pKey);
+ return (XmlSchema)schemas.get(pKey);
}
void addSchema(SchemaKey pKey, XmlSchema pSchema) {
if (schemas.containsKey(pKey)) {
- throw new IllegalStateException("A schema with target namespace "
- + pKey.getNamespace() + " and system ID " + pKey.getSystemId()
- + " is already present.");
+ throw new IllegalStateException("A schema with target namespace " + pKey.getNamespace()
+ + " and system ID " + pKey.getSystemId() + " is already present.");
}
schemas.put(pKey, pSchema);
}
- private void addSimpleType(XmlSchema schema,String typeName){
+ private void addSimpleType(XmlSchema schema, String typeName) {
XmlSchemaSimpleType type;
type = new XmlSchemaSimpleType(schema);
type.setName(typeName);
schema.addType(type);
}
+
public XmlSchema read(Reader r, ValidationEventHandler veh) {
return read(new InputSource(r), veh);
}
XmlSchema read(final InputSource inputSource, ValidationEventHandler veh,
- TargetNamespaceValidator namespaceValidator) {
+ TargetNamespaceValidator namespaceValidator) {
try {
DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();
docFac.setNamespaceAware(true);
@@ -389,31 +355,31 @@
}
}
- private Document parse_doPriv(final InputSource inputSource, final DocumentBuilder builder, Document doc) throws IOException, SAXException {
+ private Document parse_doPriv(final InputSource inputSource, final DocumentBuilder builder, Document doc)
+ throws IOException, SAXException {
try {
- doc = (Document) java.security.AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws IOException, SAXException {
- return builder.parse(inputSource);
- }
- }
- );
+ doc = (Document)java.security.AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws IOException, SAXException {
+ return builder.parse(inputSource);
+ }
+ });
} catch (PrivilegedActionException e) {
Exception exception = e.getException();
- if(exception instanceof IOException) {
- throw (IOException) exception;
+ if (exception instanceof IOException) {
+ throw (IOException)exception;
}
- if(exception instanceof SAXException) {
- throw (SAXException) exception;
+ if (exception instanceof SAXException) {
+ throw (SAXException)exception;
}
}
return doc;
}
/**
- * Read an XML schema into the collection from a SAX InputSource.
- * Schemas in a collection must be unique in the concatenation of system ID and
- * targetNamespace. In this API, the systemID is taken from the source.
+ * Read an XML schema into the collection from a SAX InputSource. Schemas in a collection must be unique
+ * in the concatenation of system ID and targetNamespace. In this API, the systemID is taken from the
+ * source.
+ *
* @param inputSource the XSD document.
* @param veh handler that is called back for validation.
* @return the XML schema object.
@@ -421,26 +387,26 @@
public XmlSchema read(InputSource inputSource, ValidationEventHandler veh) {
return read(inputSource, veh, null);
}
-
+
/**
- * Read an XML schema into the collection from a TRaX source.
- * Schemas in a collection must be unique in the concatenation of system ID and
- * targetNamespace. In this API, the systemID is taken from the Source.
+ * Read an XML schema into the collection from a TRaX source. Schemas in a collection must be unique in
+ * the concatenation of system ID and targetNamespace. In this API, the systemID is taken from the Source.
+ *
* @param source the XSD document.
* @param veh handler that is called back for validation.
* @return the XML schema object.
*/
public XmlSchema read(Source source, ValidationEventHandler veh) {
if (source instanceof SAXSource) {
- return read(((SAXSource) source).getInputSource(), veh);
+ return read(((SAXSource)source).getInputSource(), veh);
} else if (source instanceof DOMSource) {
- Node node = ((DOMSource) source).getNode();
+ Node node = ((DOMSource)source).getNode();
if (node instanceof Document) {
- node = ((Document) node).getDocumentElement();
+ node = ((Document)node).getDocumentElement();
}
- return read((Document) node, veh);
+ return read((Document)node, veh);
} else if (source instanceof StreamSource) {
- StreamSource ss = (StreamSource) source;
+ StreamSource ss = (StreamSource)source;
InputSource isource = new InputSource(ss.getSystemId());
isource.setByteStream(ss.getInputStream());
isource.setCharacterStream(ss.getReader());
@@ -453,9 +419,10 @@
}
/**
- * Read an XML schema into the collection from a DOM document.
- * Schemas in a collection must be unique in the concatenation of system ID and
- * targetNamespace. In this API, the systemID is taken from the document.
+ * Read an XML schema into the collection from a DOM document. Schemas in a collection must be unique in
+ * the concatenation of system ID and targetNamespace. In this API, the systemID is taken from the
+ * document.
+ *
* @param doc the XSD document.
* @param veh handler that is called back for validation.
* @return the XML schema object.
@@ -465,11 +432,10 @@
return builder.build(doc, null, veh);
}
-
/**
- * Read an XML Schema into the collection from a DOM element. Schemas in a collection
- * must be unique in the concatentation of System ID and targetNamespace. The system ID will
- * be empty for this API.
+ * Read an XML Schema into the collection from a DOM element. Schemas in a collection must be unique in
+ * the concatentation of System ID and targetNamespace. The system ID will be empty for this API.
+ *
* @param elem the DOM element for the schema.
* @return the XmlSchema
*/
@@ -481,9 +447,9 @@
}
/**
- * Read an XML Schema from a complete XSD XML DOM Document into this collection.
- * Schemas in a collection must be unique in
- * the concatenation of SystemId and targetNamespace.
+ * Read an XML Schema from a complete XSD XML DOM Document into this collection. Schemas in a collection
+ * must be unique in the concatenation of SystemId and targetNamespace.
+ *
* @param doc The schema document.
* @param systemId System ID for this schema.
* @param veh handler to be called to check validity of the schema.
@@ -494,9 +460,9 @@
}
/**
- * Read an XML Schema from a complete XSD XML DOM Document into this collection.
- * Schemas in a collection must be unique in
- * the concatenation of SystemId and targetNamespace.
+ * Read an XML Schema from a complete XSD XML DOM Document into this collection. Schemas in a collection
+ * must be unique in the concatenation of SystemId and targetNamespace.
+ *
* @param doc Source document.
* @param systemId System id.
* @param veh Stub for future capability to handle validation errors.
@@ -504,16 +470,17 @@
* @return the schema object.
*/
public XmlSchema read(Document doc, String systemId, ValidationEventHandler veh,
- TargetNamespaceValidator validator) {
+ TargetNamespaceValidator validator) {
SchemaBuilder builder = new SchemaBuilder(this, validator);
XmlSchema schema = builder.build(doc, systemId, veh);
schema.setInputEncoding(DOMUtil.getInputEncoding(doc));
- return schema;
+ return schema;
}
/**
- * Read a schema from a DOM tree into the collection. The schemas in a collection must be unique
- * in the concatenation of the target namespace and the system ID.
+ * Read a schema from a DOM tree into the collection. The schemas in a collection must be unique in the
+ * concatenation of the target namespace and the system ID.
+ *
* @param elem xs:schema DOM element.
* @param systemId System id.
* @return the schema object.
@@ -524,7 +491,7 @@
xmlSchema.setInputEncoding(DOMUtil.getInputEncoding(elem.getOwnerDocument()));
return xmlSchema;
}
-
+
/**
* Creates new XmlSchemaCollection
*/
@@ -533,13 +500,12 @@
}
/**
- * Retrieve a set containing the XmlSchema instances with the given system ID.
- * In general, this will return a single instance, or none. However,
- * if the schema has no targetNamespace attribute and was included
- * from schemata with different target namespaces, then it may
- * occur, that multiple schema instances with different logical
- * target namespaces may be returned.
- * @param systemId the system id for this schema
+ * Retrieve a set containing the XmlSchema instances with the given system ID. In general, this will
+ * return a single instance, or none. However, if the schema has no targetNamespace attribute and was
+ * included from schemata with different target namespaces, then it may occur, that multiple schema
+ * instances with different logical target namespaces may be returned.
+ *
+ * @param systemId the system id for this schema
* @return array of XmlSchema objects
*/
public XmlSchema[] getXmlSchema(String systemId) {
@@ -547,94 +513,97 @@
systemId = "";
}
final List result = new ArrayList();
- for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) iter.next();
- if (((SchemaKey) entry.getKey()).getSystemId().equals(systemId)) {
+ for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ if (((SchemaKey)entry.getKey()).getSystemId().equals(systemId)) {
result.add(entry.getValue());
}
}
- return (XmlSchema[]) result.toArray(new XmlSchema[result.size()]);
+ return (XmlSchema[])result.toArray(new XmlSchema[result.size()]);
}
/**
* Returns an array of all the XmlSchemas in this collection.
+ *
* @return the list of XmlSchema objects
*/
public XmlSchema[] getXmlSchemas() {
Collection c = schemas.values();
- return (XmlSchema[]) c.toArray(new XmlSchema[c.size()]);
+ return (XmlSchema[])c.toArray(new XmlSchema[c.size()]);
}
-
/**
- * Retrieve a global element from the schema collection.
+ * Retrieve a global element from the schema collection.
+ *
* @param qname the element QName.
* @return the element object, or null.
*/
public XmlSchemaElement getElementByQName(QName qname) {
- String uri = qname.getNamespaceURI();
- for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- if (((SchemaKey) entry.getKey()).getNamespace().equals(uri)) {
- XmlSchemaElement element = ((XmlSchema) entry.getValue())
- .getElementByName(qname);
- if (element != null) {
- return element;
- }
- }
- }
- return null;
- }
+ String uri = qname.getNamespaceURI();
+ for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ if (((SchemaKey)entry.getKey()).getNamespace().equals(uri)) {
+ XmlSchemaElement element = ((XmlSchema)entry.getValue()).getElementByName(qname);
+ if (element != null) {
+ return element;
+ }
+ }
+ }
+ return null;
+ }
/**
* Retrieve a global type from the schema collection.
+ *
* @param schemaTypeName the QName of the type.
* @return the type object, or null.
*/
public XmlSchemaType getTypeByQName(QName schemaTypeName) {
- String uri = schemaTypeName.getNamespaceURI();
- for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext();) {
- Map.Entry entry = (Map.Entry) iter.next();
- if (((SchemaKey) entry.getKey()).getNamespace().equals(uri)) {
- XmlSchemaType type = ((XmlSchema) entry.getValue())
- .getTypeByName(schemaTypeName);
- if (type != null) {
- return type;
- }
- }
- }
- return null;
- }
-
+ String uri = schemaTypeName.getNamespaceURI();
+ for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ if (((SchemaKey)entry.getKey()).getNamespace().equals(uri)) {
+ XmlSchemaType type = ((XmlSchema)entry.getValue()).getTypeByName(schemaTypeName);
+ if (type != null) {
+ return type;
+ }
+ }
+ }
+ return null;
+ }
+
/**
* Find a global attribute by QName in this collection of schemas.
+ *
* @param schemaAttributeName the name of the attribute.
* @return the attribute or null.
*/
public XmlSchemaAttribute getAttributeByQName(QName schemaAttributeName) {
String uri = schemaAttributeName.getNamespaceURI();
- for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) iter.next();
- if (((SchemaKey) entry.getKey()).getNamespace().equals(uri)) {
- XmlSchemaAttribute attribute = ((XmlSchema) entry.getValue()).getAttributeByName(schemaAttributeName);
+ for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ if (((SchemaKey)entry.getKey()).getNamespace().equals(uri)) {
+ XmlSchemaAttribute attribute = ((XmlSchema)entry.getValue())
+ .getAttributeByName(schemaAttributeName);
if (attribute != null) {
return attribute;
}
- }
+ }
}
return null;
}
-
+
/**
* Return the schema from this collection for a particular targetNamespace.
+ *
* @param uri target namespace URI.
* @return the schema.
*/
public XmlSchema schemaForNamespace(String uri) {
- for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Map.Entry) iter.next();
- if (((SchemaKey) entry.getKey()).getNamespace().equals(uri)) {
- return (XmlSchema) entry.getValue();
+ for (Iterator iter = schemas.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ if (((SchemaKey)entry.getKey()).getNamespace().equals(uri)) {
+ return (XmlSchema)entry.getValue();
}
}
return null;
@@ -653,10 +622,11 @@
void resolveType(QName typeName, XmlSchemaType type) {
ArrayList receivers = (ArrayList)unresolvedTypes.get(typeName);
- if (receivers == null)
+ if (receivers == null) {
return;
+ }
for (Iterator i = receivers.iterator(); i.hasNext();) {
- TypeReceiver receiver = (TypeReceiver) i.next();
+ TypeReceiver receiver = (TypeReceiver)i.next();
receiver.setType(type);
}
unresolvedTypes.remove(typeName);
@@ -664,6 +634,7 @@
/**
* Retrieve the namespace context.
+ *
* @return the namespace context.
*/
public NamespacePrefixList getNamespaceContext() {
@@ -671,8 +642,9 @@
}
/**
- * Set the namespace context for this collection, which controls the assignment of
- * namespace prefixes to namespaces.
+ * Set the namespace context for this collection, which controls the assignment of namespace prefixes to
+ * namespaces.
+ *
* @param namespaceContext the context.
*/
public void setNamespaceContext(NamespacePrefixList namespaceContext) {
@@ -680,9 +652,9 @@
}
/**
- * Push a schema onto the stack of schemas.
- * This function, while public, is probably not useful outside of
+ * Push a schema onto the stack of schemas. This function, while public, is probably not useful outside of
* the implementation.
+ *
* @param pKey the schema key.
*/
public void push(SchemaKey pKey) {
@@ -690,25 +662,25 @@
}
/**
- * Pop the stack of schemas. This function, while public, is probably not useful outside of
- * the implementation.
+ * Pop the stack of schemas. This function, while public, is probably not useful outside of the
+ * implementation.
*/
public void pop() {
stack.pop();
}
/**
- * Return an indication of whether a particular schema is in the working stack of
- * schemas. This function, while public, is probably not useful outside of
- * the implementation.
+ * Return an indication of whether a particular schema is in the working stack of schemas. This function,
+ * while public, is probably not useful outside of the implementation.
+ *
* @param pKey schema key
* @return true if the schema is in the stack.
*/
public boolean check(SchemaKey pKey) {
- return (stack.indexOf(pKey)==-1);
+ return stack.indexOf(pKey) == -1;
}
- public String toString() {
- return super.toString() + "[" + schemas.toString() + "]";
+ public String toString() {
+ return super.toString() + "[" + schemas.toString() + "]";
}
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContent.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContent.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContent.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContent.java Sun Dec 14 15:18:54 2008
@@ -20,14 +20,12 @@
package org.apache.ws.commons.schema;
/**
- * Class that represents the complex content model for complex types.
- * Contains extensions or restrictions on a complex type that has mixed
- * content or elements only. Represents the World Wide Web Consortium (W3C)
+ * Class that represents the complex content model for complex types. Contains extensions or restrictions on a
+ * complex type that has mixed content or elements only. Represents the World Wide Web Consortium (W3C)
* complexContent element.
*/
// Vidyanand - 16th Oct - initial implementation
-
public class XmlSchemaComplexContent extends XmlSchemaContentModel {
/**
@@ -36,9 +34,9 @@
public XmlSchemaComplexContent() {
}
- /* One of either the XmlSchemaComplexContentRestriction or
- * XmlSchemaComplexContentExtension classes.
- */
+ /*
+ * One of either the XmlSchemaComplexContentRestriction or XmlSchemaComplexContentExtension classes.
+ */
XmlSchemaContent content;
public XmlSchemaContent getContent() {
@@ -49,9 +47,10 @@
this.content = content;
}
- /* Indicates that this type has a mixed content model. Character data
- * is allowed to appear between the child elements of the complex type.
- */
+ /*
+ * Indicates that this type has a mixed content model. Character data is allowed to appear between the
+ * child elements of the complex type.
+ */
public boolean mixed;
public boolean isMixed() {
@@ -64,18 +63,21 @@
public String toString(String prefix, int tab) {
String xml = new String();
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
+ }
- if (!prefix.equals("") && prefix.indexOf(":") == -1)
+ if (!prefix.equals("") && prefix.indexOf(":") == -1) {
prefix += ":";
+ }
xml += "<" + prefix + "complexContent>\n";
xml += content.toString(prefix, (tab + 1));
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
+ }
xml += "<" + prefix + "complexContent>\n";
return xml;
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java Sun Dec 14 15:18:54 2008
@@ -21,11 +21,10 @@
import javax.xml.namespace.QName;
-
/**
- * Class for complex types with a complex content model derived by extension.
- * Extends the complex type by adding attributes or elements. Represents the
- * World Wide Web Consortium (W3C) extension element for complex content.
+ * Class for complex types with a complex content model derived by extension. Extends the complex type by
+ * adding attributes or elements. Represents the World Wide Web Consortium (W3C) extension element for complex
+ * content.
*/
public class XmlSchemaComplexContentExtension extends XmlSchemaContent {
@@ -38,7 +37,7 @@
}
- /* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/
+ /* Allows an XmlSchemaAnyAttribute to be used for the attribute value. */
XmlSchemaAnyAttribute anyAttribute;
public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
@@ -49,14 +48,17 @@
return this.anyAttribute;
}
- /* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple type.*/
+ /*
+ * Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple
+ * type.
+ */
XmlSchemaObjectCollection attributes;
public XmlSchemaObjectCollection getAttributes() {
return this.attributes;
}
- /* Name of the built-in data type, simple type, or complex type.*/
+ /* Name of the built-in data type, simple type, or complex type. */
QName baseTypeName;
public void setBaseTypeName(QName baseTypeName) {
@@ -67,7 +69,7 @@
return this.baseTypeName;
}
- /*One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes.*/
+ /* One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes. */
XmlSchemaParticle particle;
public XmlSchemaParticle getParticle() {
@@ -80,18 +82,22 @@
public String toString(String prefix, int tab) {
String xml = new String();
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
- if (!prefix.equals("") && prefix.indexOf(":") == -1)
+ }
+ if (!prefix.equals("") && prefix.indexOf(":") == -1) {
prefix += ":";
+ }
xml += "<" + prefix + "extension>\n";
- if (particle != null)
+ if (particle != null) {
xml += particle.toString(prefix, (tab + 1));
+ }
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
+ }
xml += "</" + prefix + "extension>\n";
return xml;
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java Sun Dec 14 15:18:54 2008
@@ -21,12 +21,10 @@
import javax.xml.namespace.QName;
-
/**
- * Class for complex types with a complex content model that are derived
- * by restriction. Restricts the contents of the complex type to a subset
- * of the inherited complex type. Represents the World Wide Web Consortium
- * (W3C) restriction element for complex content.
+ * Class for complex types with a complex content model that are derived by restriction. Restricts the
+ * contents of the complex type to a subset of the inherited complex type. Represents the World Wide Web
+ * Consortium (W3C) restriction element for complex content.
*/
public class XmlSchemaComplexContentRestriction extends XmlSchemaContent {
@@ -38,7 +36,7 @@
attributes = new XmlSchemaObjectCollection();
}
- /* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/
+ /* Allows an XmlSchemaAnyAttribute to be used for the attribute value. */
XmlSchemaAnyAttribute anyAttribute;
public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
@@ -49,16 +47,17 @@
return this.anyAttribute;
}
- /* Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef.
- * Collection of attributes for the simple type.
- */
+ /*
+ * Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple
+ * type.
+ */
XmlSchemaObjectCollection attributes;
public XmlSchemaObjectCollection getAttributes() {
return this.attributes;
}
- /* Name of the built-in data type, simple type, or complex type.*/
+ /* Name of the built-in data type, simple type, or complex type. */
QName baseTypeName;
public void setBaseTypeName(QName baseTypeName) {
@@ -69,9 +68,9 @@
return this.baseTypeName;
}
- /*One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll,
- * or XmlSchemaSequence classes.
- */
+ /*
+ * One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes.
+ */
XmlSchemaParticle particle;
public XmlSchemaParticle getParticle() {
@@ -84,21 +83,24 @@
public String toString(String prefix, int tab) {
String xml = new String();
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
- if (!prefix.equals("") && prefix.indexOf(":") == -1)
+ }
+ if (!prefix.equals("") && prefix.indexOf(":") == -1) {
prefix += ":";
+ }
xml += "<" + prefix + "restriction>\n";
- if (particle != null)
+ if (particle != null) {
xml += particle.toString(prefix, (tab + 1));
+ }
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
+ }
xml += "</" + prefix + "restriction>\n";
return xml;
}
}
-
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java Sun Dec 14 15:18:54 2008
@@ -24,9 +24,8 @@
import org.apache.ws.commons.schema.constants.Constants;
/**
- * Class for complex types. Defines a complex type that determines the
- * set of attributes and content of an element. Represents the World Wide
- * Web Consortium (W3C) complexType element.
+ * Class for complex types. Defines a complex type that determines the set of attributes and content of an
+ * element. Represents the World Wide Web Consortium (W3C) complexType element.
*/
public class XmlSchemaComplexType extends XmlSchemaType {
@@ -129,28 +128,33 @@
public String toString(String prefix, int tab) {
String xml = new String();
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
+ }
- if (!prefix.equals("") && prefix.indexOf(":") == -1)
+ if (!prefix.equals("") && prefix.indexOf(":") == -1) {
prefix += ":";
+ }
String typeName = name != null ? name : "";
xml += "<" + prefix + "complexType name=\"" + typeName + "\">\n";
- if (particle != null)
+ if (particle != null) {
xml += particle.toString(prefix, (tab + 1));
+ }
- if (contentModel != null)
+ if (contentModel != null) {
xml += contentModel.toString(prefix, (tab + 1));
+ }
for (int i = 0; i < attributes.getCount(); i++) {
xml += attributes.getItem(i).toString(prefix, (tab + 1));
}
- for (int i = 0; i < tab; i++)
+ for (int i = 0; i < tab; i++) {
xml += "\t";
+ }
xml += "</" + prefix + "complexType>\n";
return xml;
@@ -159,23 +163,22 @@
/**
* Return the QName of the base schema type, if any, as defined in the content model.
*/
- public QName getBaseSchemaTypeName() {
- XmlSchemaContentModel model = getContentModel();
- if (model == null) {
- return null;
- }
- XmlSchemaContent content = model.getContent();
- if (content == null) {
- return null;
- }
-
- if (!(content instanceof XmlSchemaComplexContentExtension)) {
- return null;
- }
-
- XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension) content;
- return ext.getBaseTypeName();
- }
+ public QName getBaseSchemaTypeName() {
+ XmlSchemaContentModel model = getContentModel();
+ if (model == null) {
+ return null;
+ }
+ XmlSchemaContent content = model.getContent();
+ if (content == null) {
+ return null;
+ }
+ if (!(content instanceof XmlSchemaComplexContentExtension)) {
+ return null;
+ }
+
+ XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension)content;
+ return ext.getBaseTypeName();
+ }
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java Sun Dec 14 15:18:54 2008
@@ -21,7 +21,6 @@
/**
* An abstract class for schema content.
- *
*/
public abstract class XmlSchemaContent extends XmlSchemaAnnotated {
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java?rev=726576&r1=726575&r2=726576&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java Sun Dec 14 15:18:54 2008
@@ -22,17 +22,14 @@
import org.apache.ws.commons.schema.constants.Constants;
/**
- * Provides information about the validation mode of any
- * and anyAttribute element replacements.
+ * Provides information about the validation mode of any and anyAttribute element replacements.
*/
public class XmlSchemaContentProcessing extends org.apache.ws.commons.schema.constants.Enum {
- static String[] members = new String[]{
- Constants.BlockConstants.LAX,
- Constants.BlockConstants.NONE,
- Constants.BlockConstants.SKIP,
- Constants.BlockConstants.STRICT
+ static String[] members = new String[] {
+ Constants.BlockConstants.LAX, Constants.BlockConstants.NONE, Constants.BlockConstants.SKIP,
+ Constants.BlockConstants.STRICT
};
/**