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/17 03:39:54 UTC
svn commit: r727246 [3/8] - 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/ s...
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -23,9 +23,6 @@
public class ValidationEvent extends EventObject {
- /**
- *
- */
private static final long serialVersionUID = 1L;
/**
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/ValidationEventHandler.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/ValidationEventHandler.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/ValidationEventHandler.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/ValidationEventHandler.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -19,57 +19,66 @@
package org.apache.ws.commons.schema;
-import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException;
-import org.apache.ws.commons.schema.constants.Constants;
-import org.apache.ws.commons.schema.utils.NamespaceContextOwner;
-import org.apache.ws.commons.schema.utils.NamespacePrefixList;
-import org.w3c.dom.Document;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Stack;
import javax.xml.namespace.QName;
-import javax.xml.transform.*;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import java.io.*;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Stack;
-// Ancient history, year unknown:-)
-//Oct 15th - momo - initial impl
-//Oct 17th - vidyanand - add SimpleType + element
-//Oct 18th - momo - add ComplexType
-//Oct 19th - vidyanand - handle external
-//Dec 6th - Vidyanand - changed RuntimeExceptions thrown to XmlSchemaExceptions
-//Jan 15th - Vidyanand - made changes to SchemaBuilder.handleElement to look for an element ref.
-//Feb 20th - Joni - Change the getXmlSchemaFromLocation schema
-// variable to name s.
-//Feb 21th - Joni - Port to XMLDomUtil and Tranformation.
+import org.w3c.dom.Document;
+
+import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException;
+import org.apache.ws.commons.schema.constants.Constants;
+import org.apache.ws.commons.schema.utils.NamespaceContextOwner;
+import org.apache.ws.commons.schema.utils.NamespacePrefixList;
+
/**
* 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";
+public class XmlSchema
+ extends XmlSchemaAnnotated implements NamespaceContextOwner {
static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
- XmlSchemaForm attributeFormDefault, elementFormDefault;
+ private static final String UTF_8_ENCODING = "UTF-8";
- XmlSchemaObjectTable attributeGroups, attributes, elements, groups, notations, schemaTypes;
- XmlSchemaDerivationMethod blockDefault, finalDefault;
- XmlSchemaObjectCollection includes, items;
+ XmlSchemaForm attributeFormDefault;
+ XmlSchemaForm elementFormDefault;
+
+ XmlSchemaObjectTable attributeGroups;
+ XmlSchemaObjectTable attributes;
+ XmlSchemaObjectTable elements;
+ XmlSchemaObjectTable groups;
+ XmlSchemaObjectTable notations;
+ XmlSchemaObjectTable schemaTypes;
+ XmlSchemaDerivationMethod blockDefault;
+ XmlSchemaDerivationMethod finalDefault;
+ XmlSchemaObjectCollection includes;
+ XmlSchemaObjectCollection items;
boolean isCompiled;
- String syntacticalTargetNamespace, logicalTargetNamespace, version;
- String schema_ns_prefix = "";
+ String syntacticalTargetNamespace;
+ String logicalTargetNamespace;
+ String version;
+ String schemaNamespacePrefix = "";
XmlSchemaCollection parent;
private NamespacePrefixList namespaceContext;
// keep the encoding of the input
private String inputEncoding;
- 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
@@ -112,14 +121,15 @@
notations = new XmlSchemaObjectTable();
schemaTypes = new XmlSchemaObjectTable();
- syntacticalTargetNamespace = logicalTargetNamespace = namespace;
+ logicalTargetNamespace = namespace;
+ syntacticalTargetNamespace = namespace;
if (logicalTargetNamespace == null) {
logicalTargetNamespace = "";
}
if (parent != null) {
- XmlSchemaCollection.SchemaKey schemaKey = new XmlSchemaCollection.SchemaKey(
- this.logicalTargetNamespace,
- systemId);
+ XmlSchemaCollection.SchemaKey schemaKey =
+ new XmlSchemaCollection.SchemaKey(this.logicalTargetNamespace,
+ systemId);
if (parent.containsSchema(schemaKey)) {
throw new XmlSchemaException("Schema name conflict in collection");
} else {
@@ -133,6 +143,10 @@
}
+ public void setInputEncoding(String encoding) {
+ this.inputEncoding = encoding;
+ }
+
public XmlSchemaForm getAttributeFormDefault() {
return attributeFormDefault;
}
@@ -169,76 +183,75 @@
return elements;
}
- protected XmlSchemaElement getElementByName(QName name, boolean deep, Stack schemaStack) {
+ protected XmlSchemaElement getElementByName(QName name, boolean deep, Stack<XmlSchema> 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;
- }
+ }
+
+ 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<XmlSchema>();
+ }
+ schemaStack.push(this);
+ element = schema.getElementByName(name, deep, schemaStack);
+ if (element != null) {
+ return element;
}
}
- } else {
- return element;
}
+ } else {
+ return element;
}
-
- return element;
}
+ return element;
}
- protected XmlSchemaAttribute getAttributeByName(QName name, boolean deep, Stack schemaStack) {
+ protected XmlSchemaAttribute getAttributeByName(QName name, boolean deep, Stack<XmlSchema> 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;
- }
+ }
+ 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<XmlSchema>();
+ }
+ schemaStack.push(this);
+ attribute = schema.getAttributeByName(name, deep, schemaStack);
+ if (attribute != null) {
+ return attribute;
}
}
- } else {
- return attribute;
}
+ } else {
+ return attribute;
}
-
- return attribute;
}
+
+ return attribute;
+
}
/**
@@ -280,40 +293,39 @@
* @param schemaStack
* @return the type.
*/
- protected XmlSchemaType getTypeByName(QName name, boolean deep, Stack schemaStack) {
+ protected XmlSchemaType getTypeByName(QName name, boolean deep, Stack<XmlSchema> schemaStack) {
if (schemaStack != null && schemaStack.contains(this)) {
// recursive schema - just return null
return null;
- } else {
- XmlSchemaType type = (XmlSchemaType)schemaTypes.getItem(name);
+ }
+ 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;
- }
+ 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<XmlSchema>();
+ }
+ schemaStack.push(this);
+ type = schema.getTypeByName(name, deep, schemaStack);
+ if (type != null) {
+ return type;
}
}
- } else {
- return type;
}
+ } else {
+ return type;
}
-
- return type;
}
+
+ return type;
}
/**
@@ -394,8 +406,9 @@
}
public void setTargetNamespace(String targetNamespace) {
- if (!targetNamespace.equals("")) {
- syntacticalTargetNamespace = logicalTargetNamespace = targetNamespace;
+ if (!"".equals(targetNamespace)) {
+ logicalTargetNamespace = targetNamespace;
+ syntacticalTargetNamespace = targetNamespace;
}
}
@@ -433,7 +446,7 @@
* @param out - the output stream to write to
* @param options - a map of options
*/
- public void write(OutputStream out, Map options) {
+ public void write(OutputStream out, Map<String, String> options) {
try {
if (this.inputEncoding != null && !"".equals(this.inputEncoding)) {
write(new OutputStreamWriter(out, this.inputEncoding), options);
@@ -452,8 +465,8 @@
*
* @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<String, String> options) {
+ serializeInternal(this, writer, options);
}
/**
@@ -462,7 +475,7 @@
* @param writer - the writer to write this
*/
public void write(Writer writer) {
- serialize_internal(this, writer, null);
+ serializeInternal(this, writer, null);
}
public Document[] getAllSchemas() {
@@ -484,7 +497,7 @@
* @param out
* @param options
*/
- private void serialize_internal(XmlSchema schema, Writer out, Map options) {
+ private void serializeInternal(XmlSchema schema, Writer out, Map<String, String> options) {
try {
XmlSchemaSerializer xser = new XmlSchemaSerializer();
@@ -513,13 +526,13 @@
// property in options
if (options == null) {
- options = new HashMap();
+ options = new HashMap<String, String>();
loadDefaultOptions(options);
}
- Iterator keys = options.keySet().iterator();
+ Iterator<String> keys = options.keySet().iterator();
while (keys.hasNext()) {
Object key = keys.next();
- tr.setOutputProperty((String)key, (String)options.get(key));
+ tr.setOutputProperty((String)key, options.get(key));
}
tr.transform(source, result);
@@ -540,7 +553,7 @@
*
* @param options - the map of
*/
- private void loadDefaultOptions(Map options) {
+ private void loadDefaultOptions(Map<String, String> options) {
options.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
options.put(OutputKeys.INDENT, "yes");
}
@@ -569,6 +582,7 @@
/**
* Override the equals(Object) method with equivalence checking that is specific to this class.
*/
+ @Override
public boolean equals(Object what) {
// Note: this method may no longer be required when line number/position are used correctly in
@@ -617,6 +631,11 @@
return true;
}
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
/**
* Retrieve a DOM tree for this one schema, independent of any included or related schemas.
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -26,6 +26,7 @@
*/
public class XmlSchemaAnnotated extends XmlSchemaObject {
+
/**
* Defines an annotation. Creates an annotation element. Represents the W3C annotation element.
*/
@@ -33,7 +34,8 @@
String id;
// Stores qualified attributes that do not belong to the schema target namespace.
- public Attr[] unhandledAttributes;
+ private Attr[] unhandledAttributes;
+
/**
* Creates new XmlSchemaAnnotated
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -29,16 +29,19 @@
public class XmlSchemaAny extends XmlSchemaParticle {
/**
+ * Namespaces containing the elements that can be used.
+ */
+ String namespace;
+ XmlSchemaContentProcessing processContent;
+
+
+ /**
* Creates new XmlSchemaAny
*/
public XmlSchemaAny() {
processContent = new XmlSchemaContentProcessing(Constants.BlockConstants.NONE);
}
- /**
- * Namespaces containing the elements that can be used.
- */
- String namespace;
public String getNamespace() {
return namespace;
@@ -48,8 +51,6 @@
this.namespace = namespace;
}
- XmlSchemaContentProcessing processContent;
-
public XmlSchemaContentProcessing getProcessContent() {
return processContent;
}
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -26,6 +26,8 @@
* element. Represents the World Wide Web Consortium (W3C) anyAttribute element.
*/
public class XmlSchemaAnyAttribute extends XmlSchemaAnnotated {
+ String namespace;
+ XmlSchemaContentProcessing processContent;
/**
* Creates new XmlSchemaAnyAttribute
@@ -34,8 +36,6 @@
processContent = new XmlSchemaContentProcessing(Constants.BlockConstants.NONE);
}
- String namespace;
-
public String getNamespace() {
return namespace;
}
@@ -44,8 +44,6 @@
this.namespace = namespace;
}
- XmlSchemaContentProcessing processContent;
-
public XmlSchemaContentProcessing getProcessContent() {
return processContent;
}
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -19,10 +19,10 @@
package org.apache.ws.commons.schema;
-import org.apache.ws.commons.schema.constants.Constants;
-
import javax.xml.namespace.QName;
+import org.apache.ws.commons.schema.constants.Constants;
+
/**
* Class for attribute types. Represents the World Wide Web Consortium (W3C) attribute element.
*/
@@ -31,10 +31,14 @@
public class XmlSchemaAttribute extends XmlSchemaAnnotated {
Object attributeType;
- String defaultValue, fixedValue, name;
+ String defaultValue;
+ String fixedValue;
+ String name;
XmlSchemaForm form;
XmlSchemaSimpleType schemaType;
- QName schemaTypeName, qualifiedName, refName;
+ QName schemaTypeName;
+ QName qualifiedName;
+ QName refName;
XmlSchemaUse use;
/**
@@ -69,16 +73,16 @@
return form;
}
- public void setSchemaForm(XmlSchemaForm form) {
- this.form = form;
+ public void setSchemaForm(XmlSchemaForm formValue) {
+ this.form = formValue;
}
public QName getQName() {
return qualifiedName;
}
- public void setQName(QName qualifiedName) {
- this.qualifiedName = qualifiedName;
+ public void setQName(QName qualifiedNameValue) {
+ this.qualifiedName = qualifiedNameValue;
}
public String getName() {
@@ -121,10 +125,11 @@
this.use = use;
}
- public String toString(String prefix, int tab) {
+ public String toString(String aprefix, int tab) {
+ String prefix = aprefix;
String xml = new String();
- if (!prefix.equals("") && prefix.indexOf(":") == -1) {
+ if (!"".equals(prefix) && prefix.indexOf(":") == -1) {
prefix += ":";
}
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -27,6 +27,9 @@
*/
public class XmlSchemaAttributeGroup extends XmlSchemaAnnotated {
+ XmlSchemaAnyAttribute anyAttribute;
+ XmlSchemaObjectCollection attributes;
+ QName name;
/**
* Creates new XmlSchemaAttributeGroup
@@ -35,8 +38,6 @@
attributes = new XmlSchemaObjectCollection();
}
- XmlSchemaAnyAttribute anyAttribute;
-
public XmlSchemaAnyAttribute getAnyAttribute() {
return this.anyAttribute;
}
@@ -45,8 +46,6 @@
this.anyAttribute = anyAttribute;
}
- XmlSchemaObjectCollection attributes;
-
public XmlSchemaObjectCollection getAttributes() {
return this.attributes;
}
@@ -55,8 +54,6 @@
this.attributes = attributes;
}
- QName name;
-
public QName getName() {
return this.name;
}
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -26,15 +26,14 @@
* element with the ref attribute.
*/
public class XmlSchemaAttributeGroupRef extends XmlSchemaAnnotated {
-
+ QName refName;
+
/**
* Creates new XmlSchemaAttributeGroupRef
*/
public XmlSchemaAttributeGroupRef() {
}
- QName refName;
-
public QName getRefName() {
return this.refName;
}
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -40,6 +40,13 @@
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
import org.apache.ws.commons.schema.constants.Constants;
import org.apache.ws.commons.schema.extensions.ExtensionRegistry;
import org.apache.ws.commons.schema.resolver.CollectionURIResolver;
@@ -48,51 +55,16 @@
import org.apache.ws.commons.schema.utils.DOMUtil;
import org.apache.ws.commons.schema.utils.NamespacePrefixList;
import org.apache.ws.commons.schema.utils.TargetNamespaceValidator;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
/**
* Contains a cache of XML Schema definition language (XSD).
*/
public final class XmlSchemaCollection {
- // the default extension registry
- private ExtensionRegistry extReg = new ExtensionRegistry();
-
- public ExtensionRegistry getExtReg() {
- return extReg;
- }
-
- public void setExtReg(ExtensionRegistry extReg) {
- this.extReg = extReg;
- }
-
- /**
- * 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;
- }
-
/**
- * sets the known namespace map
- *
- * @param knownNamespaceMap a map of previously known XMLSchema objects keyed by their namespace (String)
+ * base URI is used as the base for loading the imports
*/
- public void setKnownNamespaceMap(Map knownNamespaceMap) {
- this.knownNamespaceMap = knownNamespaceMap;
- }
+ String baseUri;
/**
* Key that identifies a schema in a collection, composed of a targetNamespace and a system ID.
@@ -106,19 +78,16 @@
systemId = pSystemId == null ? "" : pSystemId;
}
- String getNamespace() {
- return namespace;
- }
-
- String getSystemId() {
- return systemId;
- }
-
+ @Override
public int hashCode() {
- final int PRIME = 31;
- return (PRIME + namespace.hashCode()) * PRIME + systemId.hashCode();
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
+ result = prime * result + ((systemId == null) ? 0 : systemId.hashCode());
+ return result;
}
+ @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
@@ -129,61 +98,147 @@
if (getClass() != obj.getClass()) {
return false;
}
- final SchemaKey other = (SchemaKey)obj;
- return namespace.equals(other.namespace) && systemId.equals(other.systemId);
+ SchemaKey other = (SchemaKey)obj;
+ if (namespace == null) {
+ if (other.namespace != null) {
+ return false;
+ }
+ } else if (!namespace.equals(other.namespace)) {
+ return false;
+ }
+ if (systemId == null) {
+ if (other.systemId != null) {
+ return false;
+ }
+ } else if (!systemId.equals(other.systemId)) {
+ return false;
+ }
+ return true;
}
+
+
public String toString() {
return Constants.NULL_NS_URI.equals(namespace) ? systemId : "{" + namespace + "}" + systemId;
}
+
+ String getNamespace() {
+ return namespace;
+ }
+
+ String getSystemId() {
+ return systemId;
+ }
}
/**
- * Map of included schemas.
+ * stack to track imports (to prevent recursion)
*/
- private Map schemas = new HashMap();
+ Stack<SchemaKey> stack;
+ Map<QName, List<TypeReceiver>> unresolvedTypes;
+ XmlSchema xsd;
+ // the default extension registry
+ private ExtensionRegistry extReg;
/**
- * base URI is used as the base for loading the imports
+ * 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.
*/
- String baseUri = null;
+ private Map<String, XmlSchema> knownNamespaceMap;
+
/**
* In-scope namespaces for XML processing
*/
private NamespacePrefixList namespaceContext;
/**
- * An org.xml.sax.EntityResolver that is used to resolve the imports/includes
+ * Resolver to find included schemas.
+ */
+ private URIResolver schemaResolver;
+ /**
+ * Map of included schemas.
*/
- private URIResolver schemaResolver = new DefaultURIResolver();
+ private Map<SchemaKey, XmlSchema> schemas;
- XmlSchema xsd = new XmlSchema(XmlSchema.SCHEMA_NS, this);
+ /**
+ * Creates new XmlSchemaCollection
+ */
+ public XmlSchemaCollection() {
+ init();
+ }
/**
- * stack to track imports (to prevent recursion)
+ * 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.
*/
- Stack stack = new Stack();
+ public boolean check(SchemaKey pKey) {
+ return stack.indexOf(pKey) == -1;
+ }
/**
- * Set the base URI. This is used when schemas need to be loaded from relative locations
+ * Find a global attribute by QName in this collection of schemas.
*
- * @param baseUri baseUri for this collection.
+ * @param schemaAttributeName the name of the attribute.
+ * @return the attribute or null.
*/
- public void setBaseUri(String baseUri) {
- this.baseUri = baseUri;
- if (schemaResolver instanceof CollectionURIResolver) {
- CollectionURIResolver resolverWithBase = (CollectionURIResolver)schemaResolver;
- resolverWithBase.setCollectionBaseURI(baseUri);
+ 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);
+ if (attribute != null) {
+ return attribute;
+ }
+ }
}
+ return null;
}
/**
- * Register a custom URI resolver
+ * Retrieve a global element from the schema collection.
*
- * @param schemaResolver resolver
+ * @param qname the element QName.
+ * @return the element object, or null.
*/
- public void setSchemaResolver(URIResolver schemaResolver) {
- this.schemaResolver = schemaResolver;
+ 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;
+ }
+
+ public ExtensionRegistry getExtReg() {
+ return extReg;
+ }
+
+ /**
+ * get the namespace map
+ *
+ * @return a map of previously known XMLSchema objects keyed by their namespace (String)
+ */
+ public Map<String, XmlSchema> getKnownNamespaceMap() {
+ return knownNamespaceMap;
+ }
+
+ /**
+ * Retrieve the namespace context.
+ *
+ * @return the namespace context.
+ */
+ public NamespacePrefixList getNamespaceContext() {
+ return namespaceContext;
}
/**
@@ -196,13 +251,73 @@
}
/**
+ * 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;
+ }
+
+ /**
+ * 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) {
+ if (systemId == null) {
+ systemId = "";
+ }
+ final List<XmlSchema> result = new ArrayList<XmlSchema>();
+ for (Map.Entry<SchemaKey, XmlSchema> entry : schemas.entrySet()) {
+ if (((SchemaKey)entry.getKey()).getSystemId().equals(systemId)) {
+ result.add(entry.getValue());
+ }
+ }
+ return 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<XmlSchema> c = schemas.values();
+ return c.toArray(new XmlSchema[c.size()]);
+ }
+
+ /**
* 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() {
-
+
+ stack = new Stack<SchemaKey>();
+ unresolvedTypes = new HashMap<QName, List<TypeReceiver>>();
+ extReg = new ExtensionRegistry();
+ knownNamespaceMap = new HashMap<String, XmlSchema>();
+ schemaResolver = new DefaultURIResolver();
+ schemas = new HashMap<SchemaKey, XmlSchema>();
+ // LAST, since the ctor for XmlSchema will reach back into here.
+ xsd = new XmlSchema(XmlSchema.SCHEMA_NS, this);
/*
* Defined in section 4.
*/
@@ -294,85 +409,96 @@
}
}
- boolean containsSchema(SchemaKey pKey) {
- return schemas.containsKey(pKey);
+ /**
+ * Pop the stack of schemas. This function, while public, is probably not useful outside of the
+ * implementation.
+ */
+ public void pop() {
+ stack.pop();
}
/**
- * gets a schema from the external namespace map
+ * Push a schema onto the stack of schemas. This function, while public, is probably not useful outside of
+ * the implementation.
*
- * @param namespace
- * @return
+ * @param pKey the schema key.
*/
- XmlSchema getKnownSchema(String namespace) {
- return (XmlSchema)knownNamespaceMap.get(namespace);
+ public void push(SchemaKey pKey) {
+ stack.push(pKey);
}
/**
- * Get a schema given a SchemaKey
+ * 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 pKey
- * @return
+ * @param doc The schema document.
+ * @param systemId System ID for this schema.
+ * @param veh handler to be called to check validity of the schema.
+ * @return the schema object.
*/
- XmlSchema getSchema(SchemaKey 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.");
- }
- schemas.put(pKey, pSchema);
+ public XmlSchema read(Document doc, String systemId, ValidationEventHandler veh) {
+ return read(doc, systemId, veh, null);
}
- private void addSimpleType(XmlSchema schema, String typeName) {
- XmlSchemaSimpleType type;
- type = new XmlSchemaSimpleType(schema);
- type.setName(typeName);
- schema.addType(type);
+ /**
+ * 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.
+ * @param validator object that is called back to check validity of the target namespace.
+ * @return the schema object.
+ */
+ public XmlSchema read(Document doc, String systemId, ValidationEventHandler veh,
+ TargetNamespaceValidator validator) {
+ SchemaBuilder builder = new SchemaBuilder(this, validator);
+ XmlSchema schema = builder.build(doc, systemId, veh);
+ schema.setInputEncoding(DOMUtil.getInputEncoding(doc));
+ return schema;
}
- public XmlSchema read(Reader r, ValidationEventHandler veh) {
- return read(new InputSource(r), veh);
+ /**
+ * 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.
+ */
+ public XmlSchema read(Document doc, ValidationEventHandler veh) {
+ SchemaBuilder builder = new SchemaBuilder(this, null);
+ return builder.build(doc, null, veh);
}
- XmlSchema read(final InputSource inputSource, ValidationEventHandler veh,
- TargetNamespaceValidator namespaceValidator) {
- try {
- DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();
- docFac.setNamespaceAware(true);
- final DocumentBuilder builder = docFac.newDocumentBuilder();
- Document doc = null;
- doc = parse_doPriv(inputSource, builder, doc);
- return read(doc, inputSource.getSystemId(), veh, namespaceValidator);
- } catch (ParserConfigurationException e) {
- throw new XmlSchemaException(e.getMessage());
- } catch (IOException e) {
- throw new XmlSchemaException(e.getMessage());
- } catch (SAXException e) {
- throw new XmlSchemaException(e.getMessage());
- }
+ /**
+ * 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
+ */
+ public XmlSchema read(Element elem) {
+ SchemaBuilder builder = new SchemaBuilder(this, null);
+ XmlSchema xmlSchema = builder.handleXmlSchemaElement(elem, null);
+ xmlSchema.setInputEncoding(DOMUtil.getXmlEncoding(elem.getOwnerDocument()));
+ return xmlSchema;
}
- 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);
- }
- });
- } catch (PrivilegedActionException e) {
- Exception exception = e.getException();
- if (exception instanceof IOException) {
- throw (IOException)exception;
- }
- if (exception instanceof SAXException) {
- throw (SAXException)exception;
- }
- }
- return doc;
+ /**
+ * 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.
+ */
+ 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()));
+ return xmlSchema;
}
/**
@@ -388,6 +514,10 @@
return read(inputSource, veh, null);
}
+ public XmlSchema read(Reader r, ValidationEventHandler veh) {
+ return read(new InputSource(r), veh);
+ }
+
/**
* 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.
@@ -419,209 +549,134 @@
}
/**
- * 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.
+ * Return the schema from this collection for a particular targetNamespace.
*
- * @param doc the XSD document.
- * @param veh handler that is called back for validation.
- * @return the XML schema object.
+ * @param uri target namespace URI.
+ * @return the schema.
*/
- public XmlSchema read(Document doc, ValidationEventHandler veh) {
- SchemaBuilder builder = new SchemaBuilder(this, null);
- return builder.build(doc, null, veh);
+ 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();
+ }
+ }
+ return null;
}
/**
- * 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.
+ * Set the base URI. This is used when schemas need to be loaded from relative locations
*
- * @param elem the DOM element for the schema.
- * @return the XmlSchema
+ * @param baseUri baseUri for this collection.
*/
- public XmlSchema read(Element elem) {
- SchemaBuilder builder = new SchemaBuilder(this, null);
- XmlSchema xmlSchema = builder.handleXmlSchemaElement(elem, null);
- xmlSchema.setInputEncoding(DOMUtil.getXmlEncoding(elem.getOwnerDocument()));
- return xmlSchema;
+ public void setBaseUri(String baseUri) {
+ this.baseUri = baseUri;
+ if (schemaResolver instanceof CollectionURIResolver) {
+ CollectionURIResolver resolverWithBase = (CollectionURIResolver)schemaResolver;
+ resolverWithBase.setCollectionBaseURI(baseUri);
+ }
}
- /**
- * 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.
- * @return the schema object.
- */
- public XmlSchema read(Document doc, String systemId, ValidationEventHandler veh) {
- return read(doc, systemId, veh, null);
+ public void setExtReg(ExtensionRegistry extReg) {
+ this.extReg = extReg;
}
/**
- * 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.
+ * sets the known namespace map
*
- * @param doc Source document.
- * @param systemId System id.
- * @param veh Stub for future capability to handle validation errors.
- * @param validator object that is called back to check validity of the target namespace.
- * @return the schema object.
+ * @param knownNamespaceMap a map of previously known XMLSchema objects keyed by their namespace (String)
*/
- public XmlSchema read(Document doc, String systemId, ValidationEventHandler veh,
- TargetNamespaceValidator validator) {
- SchemaBuilder builder = new SchemaBuilder(this, validator);
- XmlSchema schema = builder.build(doc, systemId, veh);
- schema.setInputEncoding(DOMUtil.getInputEncoding(doc));
- return schema;
+ public void setKnownNamespaceMap(Map<String, XmlSchema> knownNamespaceMap) {
+ this.knownNamespaceMap = knownNamespaceMap;
}
/**
- * 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.
+ * Set the namespace context for this collection, which controls the assignment of namespace prefixes to
+ * namespaces.
*
- * @param elem xs:schema DOM element.
- * @param systemId System id.
- * @return the schema object.
- */
- 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()));
- return xmlSchema;
- }
-
- /**
- * Creates new XmlSchemaCollection
+ * @param namespaceContext the context.
*/
- public XmlSchemaCollection() {
- init();
+ public void setNamespaceContext(NamespacePrefixList namespaceContext) {
+ this.namespaceContext = namespaceContext;
}
/**
- * 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.
+ * Register a custom URI resolver
*
- * @param systemId the system id for this schema
- * @return array of XmlSchema objects
+ * @param schemaResolver resolver
*/
- public XmlSchema[] getXmlSchema(String systemId) {
- if (systemId == null) {
- 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)) {
- result.add(entry.getValue());
- }
- }
- return (XmlSchema[])result.toArray(new XmlSchema[result.size()]);
+ public void setSchemaResolver(URIResolver schemaResolver) {
+ this.schemaResolver = schemaResolver;
}
- /**
- * 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()]);
+ public String toString() {
+ return super.toString() + "[" + schemas.toString() + "]";
}
- /**
- * 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;
- }
- }
+ 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.");
}
- return null;
+ schemas.put(pKey, pSchema);
}
- /**
- * 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;
- }
- }
+ void addUnresolvedType(QName type, TypeReceiver receiver) {
+ List<TypeReceiver> receivers = unresolvedTypes.get(type);
+ if (receivers == null) {
+ receivers = new ArrayList<TypeReceiver>();
+ unresolvedTypes.put(type, receivers);
}
- return null;
+ receivers.add(receiver);
+ }
+
+ boolean containsSchema(SchemaKey pKey) {
+ return schemas.containsKey(pKey);
}
/**
- * Find a global attribute by QName in this collection of schemas.
+ * gets a schema from the external namespace map
*
- * @param schemaAttributeName the name of the attribute.
- * @return the attribute or null.
+ * @param namespace
+ * @return
*/
- 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);
- if (attribute != null) {
- return attribute;
- }
- }
- }
- return null;
+ XmlSchema getKnownSchema(String namespace) {
+ return (XmlSchema)knownNamespaceMap.get(namespace);
}
/**
- * Return the schema from this collection for a particular targetNamespace.
+ * Get a schema given a SchemaKey
*
- * @param uri target namespace URI.
- * @return the schema.
+ * @param pKey
+ * @return
*/
- 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();
- }
- }
- return null;
+ XmlSchema getSchema(SchemaKey pKey) {
+ return schemas.get(pKey);
}
- Map unresolvedTypes = new HashMap();
-
- void addUnresolvedType(QName type, TypeReceiver receiver) {
- ArrayList receivers = (ArrayList)unresolvedTypes.get(type);
- if (receivers == null) {
- receivers = new ArrayList();
- unresolvedTypes.put(type, receivers);
+ XmlSchema read(final InputSource inputSource, ValidationEventHandler veh,
+ TargetNamespaceValidator namespaceValidator) {
+ try {
+ DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();
+ docFac.setNamespaceAware(true);
+ final DocumentBuilder builder = docFac.newDocumentBuilder();
+ Document doc = null;
+ doc = parseDoPriv(inputSource, builder, doc);
+ return read(doc, inputSource.getSystemId(), veh, namespaceValidator);
+ } catch (ParserConfigurationException e) {
+ throw new XmlSchemaException(e.getMessage());
+ } catch (IOException e) {
+ throw new XmlSchemaException(e.getMessage());
+ } catch (SAXException e) {
+ throw new XmlSchemaException(e.getMessage());
}
- receivers.add(receiver);
}
void resolveType(QName typeName, XmlSchemaType type) {
- ArrayList receivers = (ArrayList)unresolvedTypes.get(typeName);
+ List receivers = unresolvedTypes.get(typeName);
if (receivers == null) {
return;
}
@@ -632,55 +687,30 @@
unresolvedTypes.remove(typeName);
}
- /**
- * Retrieve the namespace context.
- *
- * @return the namespace context.
- */
- public NamespacePrefixList getNamespaceContext() {
- return namespaceContext;
- }
-
- /**
- * 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) {
- this.namespaceContext = namespaceContext;
- }
-
- /**
- * 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) {
- stack.push(pKey);
- }
-
- /**
- * 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.
- *
- * @param pKey schema key
- * @return true if the schema is in the stack.
- */
- public boolean check(SchemaKey pKey) {
- return stack.indexOf(pKey) == -1;
+ private void addSimpleType(XmlSchema schema, String typeName) {
+ XmlSchemaSimpleType type;
+ type = new XmlSchemaSimpleType(schema);
+ type.setName(typeName);
+ schema.addType(type);
}
- public String toString() {
- return super.toString() + "[" + schemas.toString() + "]";
+ private Document parseDoPriv(final InputSource inputSource, final DocumentBuilder builder, Document doc)
+ throws IOException, SAXException {
+ try {
+ doc = java.security.AccessController.doPrivileged(new PrivilegedExceptionAction<Document>() {
+ public Document 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 SAXException) {
+ throw (SAXException)exception;
+ }
+ }
+ return doc;
}
}
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -24,9 +24,17 @@
* 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 {
+ /*
+ * One of either the XmlSchemaComplexContentRestriction or XmlSchemaComplexContentExtension classes.
+ */
+ XmlSchemaContent content;
+ /*
+ * Indicates that this type has a mixed content model. Character data is allowed to appear between the
+ * child elements of the complex type.
+ */
+ private boolean mixed;
+
/**
* Creates new XmlSchemaComplexContent
@@ -34,11 +42,6 @@
public XmlSchemaComplexContent() {
}
- /*
- * One of either the XmlSchemaComplexContentRestriction or XmlSchemaComplexContentExtension classes.
- */
- XmlSchemaContent content;
-
public XmlSchemaContent getContent() {
return this.content;
}
@@ -47,11 +50,6 @@
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.
- */
- public boolean mixed;
public boolean isMixed() {
return this.mixed;
@@ -67,13 +65,13 @@
xml += "\t";
}
- if (!prefix.equals("") && prefix.indexOf(":") == -1) {
+ if (!"".equals(prefix) && prefix.indexOf(":") == -1) {
prefix += ":";
}
xml += "<" + prefix + "complexContent>\n";
- xml += content.toString(prefix, (tab + 1));
+ xml += content.toString(prefix, tab + 1);
for (int i = 0; i < tab; i++) {
xml += "\t";
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -29,6 +29,19 @@
public class XmlSchemaComplexContentExtension extends XmlSchemaContent {
+ /* Allows an XmlSchemaAnyAttribute to be used for the attribute value. */
+ XmlSchemaAnyAttribute anyAttribute;
+ /*
+ * Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple
+ * type.
+ */
+ XmlSchemaObjectCollection attributes;
+ /* Name of the built-in data type, simple type, or complex type. */
+ QName baseTypeName;
+
+ /* One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes. */
+ XmlSchemaParticle particle;
+
/**
* Creates new XmlSchemaComplexContentExtension
*/
@@ -37,9 +50,6 @@
}
- /* Allows an XmlSchemaAnyAttribute to be used for the attribute value. */
- XmlSchemaAnyAttribute anyAttribute;
-
public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
this.anyAttribute = anyAttribute;
}
@@ -48,19 +58,10 @@
return this.anyAttribute;
}
- /*
- * 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. */
- QName baseTypeName;
-
public void setBaseTypeName(QName baseTypeName) {
this.baseTypeName = baseTypeName;
}
@@ -69,9 +70,6 @@
return this.baseTypeName;
}
- /* One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes. */
- XmlSchemaParticle particle;
-
public XmlSchemaParticle getParticle() {
return this.particle;
}
@@ -85,14 +83,14 @@
for (int i = 0; i < tab; i++) {
xml += "\t";
}
- if (!prefix.equals("") && prefix.indexOf(":") == -1) {
+ if (!"".equals(prefix) && prefix.indexOf(":") == -1) {
prefix += ":";
}
xml += "<" + prefix + "extension>\n";
if (particle != null) {
- xml += particle.toString(prefix, (tab + 1));
+ xml += particle.toString(prefix, tab + 1);
}
for (int i = 0; i < tab; i++) {
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -28,6 +28,20 @@
*/
public class XmlSchemaComplexContentRestriction extends XmlSchemaContent {
+ /* Allows an XmlSchemaAnyAttribute to be used for the attribute value. */
+ XmlSchemaAnyAttribute anyAttribute;
+ /*
+ * Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection of attributes for the simple
+ * type.
+ */
+ XmlSchemaObjectCollection attributes;
+ /* Name of the built-in data type, simple type, or complex type. */
+ QName baseTypeName;
+ /*
+ * One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes.
+ */
+ XmlSchemaParticle particle;
+
/**
* Creates new XmlSchemaComplexContentRestriction
@@ -36,9 +50,6 @@
attributes = new XmlSchemaObjectCollection();
}
- /* Allows an XmlSchemaAnyAttribute to be used for the attribute value. */
- XmlSchemaAnyAttribute anyAttribute;
-
public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
this.anyAttribute = anyAttribute;
}
@@ -47,19 +58,10 @@
return this.anyAttribute;
}
- /*
- * 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. */
- QName baseTypeName;
-
public void setBaseTypeName(QName baseTypeName) {
this.baseTypeName = baseTypeName;
}
@@ -68,11 +70,6 @@
return this.baseTypeName;
}
- /*
- * One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes.
- */
- XmlSchemaParticle particle;
-
public XmlSchemaParticle getParticle() {
return this.particle;
}
@@ -86,14 +83,14 @@
for (int i = 0; i < tab; i++) {
xml += "\t";
}
- if (!prefix.equals("") && prefix.indexOf(":") == -1) {
+ if (!"".equals(prefix) && prefix.indexOf(":") == -1) {
prefix += ":";
}
xml += "<" + prefix + "restriction>\n";
if (particle != null) {
- xml += particle.toString(prefix, (tab + 1));
+ xml += particle.toString(prefix, tab + 1);
}
for (int i = 0; i < tab; i++) {
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -29,14 +29,18 @@
*/
public class XmlSchemaComplexType extends XmlSchemaType {
- XmlSchemaAnyAttribute anyAttribute, attributeWildcard;
+ XmlSchemaAnyAttribute anyAttribute;
+ XmlSchemaAnyAttribute attributeWildcard;
XmlSchemaObjectCollection attributes;
XmlSchemaObjectTable attributeUses;
- XmlSchemaDerivationMethod block, blockResolved;
+ XmlSchemaDerivationMethod block;
+ XmlSchemaDerivationMethod blockResolved;
XmlSchemaContentModel contentModel;
XmlSchemaContentType contentType;
- XmlSchemaParticle particleType, particle;
- boolean isAbstract, isMixed;
+ XmlSchemaParticle particleType;
+ XmlSchemaParticle particle;
+ boolean isAbstract;
+ boolean isMixed;
/**
* Creates new XmlSchemaComplexType
@@ -132,7 +136,7 @@
xml += "\t";
}
- if (!prefix.equals("") && prefix.indexOf(":") == -1) {
+ if (!"".equals(prefix) && prefix.indexOf(":") == -1) {
prefix += ":";
}
@@ -141,15 +145,15 @@
xml += "<" + prefix + "complexType name=\"" + typeName + "\">\n";
if (particle != null) {
- xml += particle.toString(prefix, (tab + 1));
+ xml += particle.toString(prefix, tab + 1);
}
if (contentModel != null) {
- xml += contentModel.toString(prefix, (tab + 1));
+ xml += contentModel.toString(prefix, tab + 1);
}
for (int i = 0; i < attributes.getCount(); i++) {
- xml += attributes.getItem(i).toString(prefix, (tab + 1));
+ xml += attributes.getItem(i).toString(prefix, tab + 1);
}
for (int i = 0; i < tab; i++) {
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentModel.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentModel.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentModel.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentModel.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
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=727246&r1=727245&r2=727246&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 Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDatatype.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDatatype.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDatatype.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDatatype.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDocumentation.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDocumentation.java?rev=727246&r1=727245&r2=727246&view=diff
==============================================================================
--- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDocumentation.java (original)
+++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDocumentation.java Tue Dec 16 18:39:50 2008
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -28,11 +28,6 @@
public class XmlSchemaDocumentation extends XmlSchemaObject {
- /**
- * Creates new XmlSchemaDocumentation
- */
- public XmlSchemaDocumentation() {
- }
/**
* Provides the source of the application information.
@@ -44,6 +39,12 @@
* Returns an array of XmlNode that represents the document text markup.
*/
NodeList markup;
+
+ /**
+ * Creates new XmlSchemaDocumentation
+ */
+ public XmlSchemaDocumentation() {
+ }
public String getSource() {
return source;