You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by di...@apache.org on 2005/09/21 00:55:17 UTC

svn commit: r290580 [2/5] - in /webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema: ./ constants/ utils/

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/TypeReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/TypeReceiver.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/TypeReceiver.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/TypeReceiver.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * A TypeReceiver is something that can have its type set.  This gets used
+ * to resolve forward references.
+ */
+public interface TypeReceiver {
+    void setType(XmlSchemaType type);
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/ValidationEvent.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/ValidationEvent.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/ValidationEvent.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/ValidationEvent.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import java.util.EventObject;
+
+/**
+ * @author mukund
+ */
+
+public class ValidationEvent extends EventObject {
+
+    /**
+     * Creates new ValidationEvent
+     */
+    public ValidationEvent(Object source) {
+        super(source);
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/ValidationEventHandler.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/ValidationEventHandler.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/ValidationEventHandler.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/ValidationEventHandler.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * @author mukund
+ */
+
+public class ValidationEventHandler {
+
+    /**
+     * Creates new ValidationEventHandler
+     */
+    public ValidationEventHandler() {
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchema.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchema.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchema.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchema.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import org.w3c.dom.Document;
+
+import javax.xml.namespace.QName;
+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.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Hashtable;
+
+
+/**
+ * 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
+ *
+ * @author mukund
+ */
+
+// 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.  
+
+public class XmlSchema extends XmlSchemaAnnotated {
+    static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
+    XmlSchemaForm attributeFormDefault, elementFormDefault;
+
+    XmlSchemaObjectTable attributeGroups,
+    attributes, elements, groups,
+    notations, schemaTypes;
+    XmlSchemaDerivationMethod blockDefault, finalDefault;
+    XmlSchemaObjectCollection includes, items;
+    boolean isCompiled;
+    String targetNamespace = "DEFAULT", version;
+    Hashtable namespaces;
+    String schema_ns_prefix = "";
+    XmlSchemaCollection parent;
+
+    /**
+     * Creates new XmlSchema
+     */
+    public XmlSchema(XmlSchemaCollection parent) {
+        this.parent = parent;
+        attributeFormDefault = new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+        elementFormDefault = new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+        blockDefault = new XmlSchemaDerivationMethod("None");
+        finalDefault = new XmlSchemaDerivationMethod("None");
+        items = new XmlSchemaObjectCollection();
+        includes = new XmlSchemaObjectCollection();
+        namespaces = new Hashtable();
+        elements = new XmlSchemaObjectTable();
+        attributeGroups = new XmlSchemaObjectTable();
+        attributes = new XmlSchemaObjectTable();
+        groups = new XmlSchemaObjectTable();
+        notations = new XmlSchemaObjectTable();
+        schemaTypes = new XmlSchemaObjectTable();
+    }
+
+    public XmlSchema(String namespace, XmlSchemaCollection parent) {
+        this(parent);
+        targetNamespace = namespace;
+    }
+
+    protected String getNamespace(String prefix) {
+        String ns = (String)namespaces.get(prefix);
+        if (ns == null) {
+            return parent.getNamespaceForPrefix(prefix);
+        }
+        return ns;
+    }
+
+    public XmlSchemaForm getAttributeFormDefault() {
+        return attributeFormDefault;
+    }
+
+    public void setAttributeFormDefault(XmlSchemaForm value) {
+        attributeFormDefault = value;
+    }
+
+    public XmlSchemaObjectTable getAttributeGroups() {
+        return attributeGroups;
+    }
+
+    public XmlSchemaObjectTable getAttributes() {
+        return attributes;
+    }
+
+    public XmlSchemaDerivationMethod getBlockDefault() {
+        return blockDefault;
+    }
+
+    public void setBlockDefault(XmlSchemaDerivationMethod blockDefault) {
+        this.blockDefault = blockDefault;
+    }
+
+    public XmlSchemaForm getElementFormDefault() {
+        return elementFormDefault;
+    }
+
+    public void setElementFormDefault(XmlSchemaForm elementFormDefault) {
+        this.elementFormDefault = elementFormDefault;
+    }
+
+    public XmlSchemaObjectTable getElements() {
+        return elements;
+    }
+
+    public XmlSchemaElement getElementByName(QName name) {
+        return (XmlSchemaElement)elements.getItem(name);
+    }
+
+    public XmlSchemaType getTypeByName(QName name) {
+        return (XmlSchemaType)schemaTypes.getItem(name);
+    }
+
+    public XmlSchemaDerivationMethod getFinalDefault() {
+        return finalDefault;
+    }
+
+    public void setFinalDefault(XmlSchemaDerivationMethod finalDefault) {
+        this.finalDefault = finalDefault;
+    }
+
+    public XmlSchemaObjectTable getGroups() {
+        return groups;
+    }
+
+    public XmlSchemaObjectCollection getIncludes() {
+        return includes;
+    }
+
+    public boolean isCompiled() {
+        return isCompiled;
+    }
+
+    public XmlSchemaObjectCollection getItems() {
+        return items;
+    }
+
+    public XmlSchemaObjectTable getNotations() {
+        return notations;
+    }
+
+    public XmlSchemaObjectTable getSchemaTypes() {
+        return schemaTypes;
+    }
+
+    public String getTargetNamespace() {
+        return targetNamespace;
+    }
+
+    public void setTargetNamespace(String targetNamespace) {
+        if (!targetNamespace.equals(""))
+            this.targetNamespace = targetNamespace;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void compile(ValidationEventHandler eh) {
+
+    }
+
+    public void write(OutputStream out) {
+        write(new OutputStreamWriter(out));
+    }
+
+    public void write(Writer writer) {
+        serialize_internal(this, writer);
+    }
+
+    private static void serialize_internal(XmlSchema schema, Writer out) {
+        try {
+            Document[] serializedSchemas = XmlSchemaSerializer.serializeSchema(schema, true);
+            TransformerFactory trFac = TransformerFactory.newInstance();
+            Source source = new DOMSource(serializedSchemas[0]);
+            Result result = new StreamResult(out);
+            javax.xml.transform.Transformer tr = trFac.newTransformer();
+            tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            tr.setOutputProperty(OutputKeys.INDENT, "yes");
+            tr.transform(source, result);
+            out.flush();
+        } catch (TransformerConfigurationException e) {
+            throw new XmlSchemaException(e.getMessage());
+        } catch (TransformerException e) {
+            throw new XmlSchemaException(e.getMessage());
+        } catch (XmlSchemaSerializer.XmlSchemaSerializerException e) {
+            throw new XmlSchemaException(e.getMessage());
+        } catch (IOException e) {
+            throw new XmlSchemaException(e.getMessage());
+        }
+    }
+
+    public Hashtable getPrefixToNamespaceMap() {
+        return namespaces;
+    }
+
+    public void setPrefixToNamespaceMap(Hashtable map) {
+        this.namespaces = map;
+    }
+
+    public void addType(XmlSchemaType type) {
+        QName qname = type.getQName();
+        if (schemaTypes.contains(qname)) {
+            throw new RuntimeException("Schema for namespace '" +
+                                       targetNamespace + "' already contains type '" +
+                                       qname.getLocalPart());
+        }
+        schemaTypes.add(qname, type);
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAll.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAll.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAll.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAll.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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).
+ *
+ * @author mukund
+ */
+public class XmlSchemaAll extends XmlSchemaGroupBase {
+
+    /**
+     * Creates new XmlSchemaAll
+     */
+    public XmlSchemaAll() {
+    }
+
+    public XmlSchemaObjectCollection getItems() {
+        return this.items;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnnotated.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnnotated.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnnotated.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnnotated.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import org.w3c.dom.Attr;
+
+/**
+ * The base class for any element that can contain annotation elements.
+ *
+ * @author mukund
+ */
+
+// October 15th - momo - initial implementation
+
+public class XmlSchemaAnnotated extends XmlSchemaObject {
+    /**
+     * Defines an annotation.
+     * Creates an annotation element.
+     * Represents the W3C annotation element.
+     */
+    XmlSchemaAnnotation annotation;
+    String id;
+
+    // Stores qualified attributes that do not belong to the schema target namespace.
+    public Attr[] unhandledAttributes;
+
+
+    /**
+     * Creates new XmlSchemaAnnotated
+     */
+    public XmlSchemaAnnotated() {
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public XmlSchemaAnnotation getAnnotation() {
+        return annotation;
+    }
+
+    public void setAnnotation(XmlSchemaAnnotation annotation) {
+        this.annotation = annotation;
+    }
+
+    public Attr[] getUnhandledAttributes() {
+        return unhandledAttributes;
+    }
+
+    public void setUnhandledAttributes(Attr[] unhandledAttributes) {
+        this.unhandledAttributes = unhandledAttributes;
+    }
+
+}
+

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnnotation.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnnotation.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnnotation.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnnotation.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+
+/**
+ * Defines an annotation. Represents the World Wide Web Consortium (W3C)
+ * annotation element.
+ *
+ * @author mukund
+ */
+
+// October 15th - momo  - initial implementation
+// Feb 15th 2002 - Joni - items initialized when instantiated.
+
+public class XmlSchemaAnnotation extends XmlSchemaObject {
+    XmlSchemaObjectCollection items;
+
+    /**
+     * Creates new XmlSchemaAnnotation
+     */
+    public XmlSchemaAnnotation() {
+        items = new XmlSchemaObjectCollection();
+    }
+
+    public XmlSchemaObjectCollection getItems() {
+        return items;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAny.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAny.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAny.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAny.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * 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.
+ *
+ * @author mukund
+ */
+
+// Feb 15th 2002 - Joni - Processing content will be initialized with "None"
+
+public class XmlSchemaAny extends XmlSchemaParticle {
+
+    /**
+     * Creates new XmlSchemaAny
+     */
+    public XmlSchemaAny() {
+        processContent = new XmlSchemaContentProcessing("None");
+    }
+
+    /**
+     * Namespaces containing the elements that can be used.
+     */
+    String namespace;
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    XmlSchemaContentProcessing processContent;
+
+    public XmlSchemaContentProcessing getProcessContent() {
+        return processContent;
+    }
+
+    public void setProcessContent(XmlSchemaContentProcessing processContent) {
+        this.processContent = processContent;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * 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.
+ *
+ * @author mukund
+ */
+public class XmlSchemaAnyAttribute extends XmlSchemaAnnotated {
+
+    /**
+     * Creates new XmlSchemaAnyAttribute
+     */
+    public XmlSchemaAnyAttribute() {
+        processContent = new XmlSchemaContentProcessing("None");
+    }
+
+    String namespace;
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    XmlSchemaContentProcessing processContent;
+
+    public XmlSchemaContentProcessing getProcessContent() {
+        return processContent;
+    }
+
+    public void setProcessContent(XmlSchemaContentProcessing processContent) {
+        this.processContent = processContent;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAppInfo.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAppInfo.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAppInfo.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAppInfo.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import org.w3c.dom.NodeList;
+
+/**
+ * Defines application specific information within an annotation.
+ * Represents the World Wide Web Consortium (W3C) appinfo element.
+ *
+ * @author mukund
+ */
+
+// Jan 24 2002 - Joni - Change the Node into NodeList
+
+
+public class XmlSchemaAppInfo extends XmlSchemaObject {
+
+    /**
+     * Provides the source of the application information.
+     */
+    String source;
+
+    /**
+     * Returns an array of XmlNode that represents the document text markup.
+     */
+    NodeList markup;
+
+    /**
+     * Creates new XmlSchemaAppInfo
+     * The default constructor initializes all fields to their default values.
+     */
+    public XmlSchemaAppInfo() {
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public NodeList getMarkup() {
+        return markup;
+    }
+
+    public void setMarkup(NodeList markup) {
+        this.markup = markup;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttribute.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttribute.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttribute.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttribute.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class for attribute types. Represents the World Wide Web Consortium
+ * (W3C) attribute element.
+ *
+ * @author mukund
+ */
+
+// October 15th - momo - initial implementation
+
+public class XmlSchemaAttribute extends XmlSchemaAnnotated {
+
+    Object attributeType;
+    String defaultValue, fixedValue, name;
+    XmlSchemaForm form;
+    XmlSchemaSimpleType schemaType;
+    QName schemaTypeName, qualifiedName, refName;
+    XmlSchemaUse use;
+
+    /**
+     * Creates new XmlSchemaAttribute
+     */
+    public XmlSchemaAttribute() {
+        form = new XmlSchemaForm(XmlSchemaForm.NONE);
+        use = new XmlSchemaUse("None");
+    }
+
+    public Object getAttributeType() {
+        return attributeType;
+    }
+
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+
+    public void setDefaultValue(String defaultValue) {
+        this.defaultValue = defaultValue;
+    }
+
+    public String getFixedValue() {
+        return fixedValue;
+    }
+
+    public void setFixedValue(String fixedValue) {
+        this.fixedValue = fixedValue;
+    }
+
+    public XmlSchemaForm getForm() {
+        return form;
+    }
+
+    public void setSchemaForm(XmlSchemaForm form) {
+        this.form = form;
+    }
+
+    public QName getQName() {
+        return qualifiedName;
+    }
+
+    public void setQName(QName qualifiedName) {
+        this.qualifiedName = qualifiedName;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public QName getRefName() {
+        return refName;
+    }
+
+    public void setRefName(QName refName) {
+        this.refName = refName;
+    }
+
+    public XmlSchemaSimpleType getSchemaType() {
+        return schemaType;
+    }
+
+    public void setSchemaType(XmlSchemaSimpleType schemaType) {
+        this.schemaType = schemaType;
+    }
+
+    public QName getSchemaTypeName() {
+        return schemaTypeName;
+    }
+
+    public void setSchemaTypeName(QName schemaTypeName) {
+        this.schemaTypeName = schemaTypeName;
+    }
+
+    public XmlSchemaUse getUse() {
+        return use;
+    }
+
+    public void setUse(XmlSchemaUse use) {
+        this.use = use;
+    }
+
+    public String toString(String prefix, int tab) {
+        String xml = new String();
+
+        if (!prefix.equals("") && prefix.indexOf(":") == -1)
+            prefix += ":";
+
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+
+        xml += "<" + prefix + "attribute name=\"" + name + "\" type=\"" + schemaTypeName + "\"/>\n";
+
+        return xml;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttributeGroup.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * 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.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaAttributeGroup extends XmlSchemaAnnotated {
+
+    /**
+     * Creates new XmlSchemaAttributeGroup
+     */
+    public XmlSchemaAttributeGroup() {
+        attributes = new XmlSchemaObjectCollection();
+    }
+
+    XmlSchemaAnyAttribute anyAttribute;
+
+    public XmlSchemaAnyAttribute getAnyAttribute() {
+        return this.anyAttribute;
+    }
+
+    public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
+        this.anyAttribute = anyAttribute;
+    }
+
+    XmlSchemaObjectCollection attributes;
+
+    public XmlSchemaObjectCollection getAttributes() {
+        return this.attributes;
+    }
+
+    public void setAttributes(XmlSchemaObjectCollection attributes) {
+        this.attributes = attributes;
+    }
+
+    String name;
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Class for the attribute group reference. Represents the World Wide
+ * Web Consortium (W3C) attributeGroup element with the ref attribute.
+ *
+ * @author mukund
+ */
+public class XmlSchemaAttributeGroupRef extends XmlSchemaAnnotated {
+
+    /**
+     * Creates new XmlSchemaAttributeGroupRef
+     */
+    public XmlSchemaAttributeGroupRef() {
+    }
+
+    QName refName;
+
+    public QName getRefName() {
+        return this.refName;
+    }
+
+    public void setRefName(QName refName) {
+        this.refName = refName;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaChoice.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaChoice.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaChoice.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaChoice.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.
+ *
+ * @author mukund
+ */
+public class XmlSchemaChoice extends XmlSchemaGroupBase {
+
+    /**
+     * Creates new XmlSchemaChoice
+     */
+    public XmlSchemaChoice() {
+    }
+
+    public XmlSchemaObjectCollection getItems() {
+        return this.items;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaCollection.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaCollection.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaCollection.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaCollection.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Contains a cache of XML Schema definition language (XSD).
+ *
+ */
+public final class XmlSchemaCollection {
+    /**
+     * Namespaces we know about.  Each one has an equivalent XmlSchema.
+     */
+    Map namespaces = new HashMap();
+
+    /**
+     * In-scope namespaces for XML processing
+     */
+    Map inScopeNamespaces = new HashMap();
+
+    XmlSchema xsd = new XmlSchema(XmlSchema.SCHEMA_NS, this);
+
+    public void init() {
+        XmlSchemaSimpleType type;
+        type = new XmlSchemaSimpleType(xsd);
+        type.setName("string");
+        xsd.addType(type);
+        type = new XmlSchemaSimpleType(xsd);
+        type.setName("int");
+        xsd.addType(type);
+        type = new XmlSchemaSimpleType(xsd);
+        type.setName("boolean");
+        xsd.addType(type);
+        type = new XmlSchemaSimpleType(xsd);
+        type.setName("float");
+        xsd.addType(type);
+        type = new XmlSchemaSimpleType(xsd);
+        type.setName("double");
+        xsd.addType(type);
+        type = new XmlSchemaSimpleType(xsd);
+        type.setName("long");
+        xsd.addType(type);
+        type = new XmlSchemaSimpleType(xsd);
+        type.setName("short");
+        xsd.addType(type);
+        type = new XmlSchemaSimpleType(xsd);
+        type.setName("qname");
+        xsd.addType(type);
+
+        namespaces.put(XmlSchema.SCHEMA_NS, xsd);
+    }
+
+    public XmlSchema read(Reader r, ValidationEventHandler veh) {
+        return read(new InputSource(r), veh);
+    }
+
+    public XmlSchema read(InputSource inputSource, ValidationEventHandler veh) {
+        try {
+            DocumentBuilderFactory docFac = DocumentBuilderFactory.newInstance();
+            docFac.setNamespaceAware(true);
+            DocumentBuilder builder = docFac.newDocumentBuilder();
+            Document doc = builder.parse(inputSource);
+            return read(doc, veh);
+        } catch (ParserConfigurationException e) {
+            throw new XmlSchemaException(e.getMessage());
+        } catch (IOException e) {
+            throw new XmlSchemaException(e.getMessage());
+        } catch (SAXException e) {
+            throw new XmlSchemaException(e.getMessage());
+        }
+    }
+
+    public XmlSchema read(Source source, ValidationEventHandler veh) {
+        try {
+            TransformerFactory trFac = TransformerFactory.newInstance();
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            StreamResult result = new StreamResult(out);
+            javax.xml.transform.Transformer tr = trFac.newTransformer();
+            tr.setOutputProperty(OutputKeys.METHOD, "xml");
+            tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+            tr.transform(source, result);
+            ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+            return read(new InputSource(in), veh);
+        } catch (TransformerException e) {
+            throw new XmlSchemaException(e.getMessage());
+        }
+    }
+
+    public XmlSchema read(Document doc, ValidationEventHandler veh) {
+        SchemaBuilder builder = new SchemaBuilder(this);
+        return builder.build(doc, veh);
+    }
+
+    public XmlSchema read(Element elem) {
+        SchemaBuilder builder = new SchemaBuilder(this);
+        return builder.handleXmlSchemaElement(elem);
+    }
+
+    /**
+     * Creates new XmlSchemaCollection
+     */
+    public XmlSchemaCollection() {
+        init();
+    }
+
+    public XmlSchemaElement getElementByQName(QName qname) {
+        XmlSchema schema = (XmlSchema)namespaces.get(qname.getNamespaceURI());
+        if (schema == null) {
+            return null;
+        }
+        return schema.getElementByName(qname);
+    }
+
+    public XmlSchemaType getTypeByQName(QName schemaTypeName) {
+        XmlSchema schema = (XmlSchema)namespaces.get(schemaTypeName.getNamespaceURI());
+        if (schema == null) {
+            return null;
+        }
+        return schema.getTypeByName(schemaTypeName);
+    }
+
+    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);
+        }
+        receivers.add(receiver);
+    }
+
+    void resolveType(QName typeName, XmlSchemaType type) {
+        ArrayList receivers = (ArrayList)unresolvedTypes.get(typeName);
+        if (receivers == null)
+            return;
+        for (Iterator i = receivers.iterator(); i.hasNext();) {
+            TypeReceiver receiver = (TypeReceiver) i.next();
+            receiver.setType(type);
+        }
+        unresolvedTypes.remove(typeName);
+    }
+
+    public String getNamespaceForPrefix(String prefix) {
+        return (String)inScopeNamespaces.get(prefix);
+    }
+
+    public void mapNamespace(String prefix, String namespaceURI) {
+        inScopeNamespaces.put(prefix, namespaceURI);
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaCollectionEnumerator.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * Supports a simple iteration over a collection. This class cannot be inherited.
+ *
+ * @author mukund
+ */
+public final class XmlSchemaCollectionEnumerator {
+
+    /**
+     * Creates new XmlSchemaCollectionEnumerator
+     */
+    public XmlSchemaCollectionEnumerator() {
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContent.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContent.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContent.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContent.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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)
+ * complexContent element.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaComplexContent extends XmlSchemaContentModel {
+
+    /**
+     * Creates new XmlSchemaComplexContent
+     */
+    public XmlSchemaComplexContent() {
+    }
+
+    /* One of either the XmlSchemaComplexContentRestriction or 
+	 * XmlSchemaComplexContentExtension classes.
+	 */
+    XmlSchemaContent content;
+
+    public XmlSchemaContent getContent() {
+        return this.content;
+    }
+
+    public void setContent(XmlSchemaContent content) {
+        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;
+    }
+
+    public void setMixed(boolean mixed) {
+        this.mixed = mixed;
+    }
+
+    public String toString(String prefix, int tab) {
+        String xml = new String();
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+
+        if (!prefix.equals("") && prefix.indexOf(":") == -1)
+            prefix += ":";
+
+        xml += "<" + prefix + "complexContent>\n";
+
+        xml += content.toString(prefix, (tab + 1));
+
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+        xml += "<" + prefix + "complexContent>\n";
+        return xml;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+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.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaComplexContentExtension extends XmlSchemaContent {
+
+    /**
+     * Creates new XmlSchemaComplexContentExtension
+     */
+    public XmlSchemaComplexContentExtension() {
+        attributes = new XmlSchemaObjectCollection();
+
+    }
+
+    /* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/
+    XmlSchemaAnyAttribute anyAttribute;
+
+    public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
+        this.anyAttribute = anyAttribute;
+    }
+
+    public XmlSchemaAnyAttribute getAnyAttribute() {
+        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;
+    }
+
+    public QName getBaseTypeName() {
+        return this.baseTypeName;
+    }
+
+    /*One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or XmlSchemaSequence classes.*/
+    XmlSchemaParticle particle;
+
+    public XmlSchemaParticle getParticle() {
+        return this.particle;
+    }
+
+    public void setParticle(XmlSchemaParticle particle) {
+        this.particle = particle;
+    }
+
+    public String toString(String prefix, int tab) {
+        String xml = new String();
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+        if (!prefix.equals("") && prefix.indexOf(":") == -1)
+            prefix += ":";
+
+        xml += "<" + prefix + "extension>\n";
+
+        if (particle != null)
+            xml += particle.toString(prefix, (tab + 1));
+
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+
+        xml += "</" + prefix + "extension>\n";
+        return xml;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+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.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaComplexContentRestriction extends XmlSchemaContent {
+
+    /**
+     * Creates new XmlSchemaComplexContentRestriction
+     */
+    public XmlSchemaComplexContentRestriction() {
+        attributes = new XmlSchemaObjectCollection();
+    }
+
+    /* Allows an XmlSchemaAnyAttribute to be used for the attribute value.*/
+    XmlSchemaAnyAttribute anyAttribute;
+
+    public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
+        this.anyAttribute = anyAttribute;
+    }
+
+    public XmlSchemaAnyAttribute getAnyAttribute() {
+        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;
+    }
+
+    public QName getBaseTypeName() {
+        return this.baseTypeName;
+    }
+
+    /*One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, 
+	 * or XmlSchemaSequence classes.
+	 */
+    XmlSchemaParticle particle;
+
+    public XmlSchemaParticle getParticle() {
+        return this.particle;
+    }
+
+    public void setParticle(XmlSchemaParticle particle) {
+        this.particle = particle;
+    }
+
+    public String toString(String prefix, int tab) {
+        String xml = new String();
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+        if (!prefix.equals("") && prefix.indexOf(":") == -1)
+            prefix += ":";
+
+        xml += "<" + prefix + "restriction>\n";
+
+        if (particle != null)
+            xml += particle.toString(prefix, (tab + 1));
+
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+
+        xml += "</" + prefix + "restriction>\n";
+        return xml;
+    }
+}
+

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexType.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexType.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexType.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaComplexType.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * 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.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaComplexType extends XmlSchemaType {
+    XmlSchemaAnyAttribute anyAttribute, attributeWildcard;
+    XmlSchemaObjectCollection attributes;
+    XmlSchemaObjectTable attributeUses;
+    XmlSchemaDerivationMethod block, blockResolved;
+    XmlSchemaContentModel contentModel;
+    XmlSchemaContentType contentType;
+    XmlSchemaParticle particleType, particle;
+    boolean isAbstract, isMixed;
+
+    /**
+     * Creates new XmlSchemaComplexType
+     */
+    public XmlSchemaComplexType(XmlSchema schema) {
+        super(schema);
+        attributes = new XmlSchemaObjectCollection();
+        block = new XmlSchemaDerivationMethod("None");
+        isAbstract = false;
+        isMixed = false;
+    }
+
+    public XmlSchemaAnyAttribute getAnyAttribute() {
+        return anyAttribute;
+    }
+
+    public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
+        this.anyAttribute = anyAttribute;
+    }
+
+    public XmlSchemaObjectCollection getAttributes() {
+        return attributes;
+    }
+
+    public XmlSchemaObjectTable getAttributeUses() {
+        return attributeUses;
+    }
+
+    public XmlSchemaAnyAttribute getAttributeWildcard() {
+        return attributeWildcard;
+    }
+
+    public XmlSchemaDerivationMethod getBlock() {
+        return block;
+    }
+
+    public void setBlock(XmlSchemaDerivationMethod block) {
+        this.block = block;
+    }
+
+    public XmlSchemaDerivationMethod getBlockResolved() {
+        return blockResolved;
+    }
+
+    public XmlSchemaContentModel getContentModel() {
+        return contentModel;
+    }
+
+    public void setContentModel(XmlSchemaContentModel contentModel) {
+        this.contentModel = contentModel;
+    }
+
+    public XmlSchemaContentType getContentType() {
+        return contentType;
+    }
+
+    public void setContentType(XmlSchemaContentType contentType) {
+        this.contentType = contentType;
+    }
+
+    public XmlSchemaParticle getContentTypeParticle() {
+        return particleType;
+    }
+
+    public boolean isAbstract() {
+        return isAbstract;
+    }
+
+    public void setAbstract(boolean b) {
+        isAbstract = b;
+    }
+
+    public boolean isMixed() {
+        return isMixed;
+    }
+
+    public void setMixed(boolean b) {
+        isMixed = b;
+    }
+
+    public XmlSchemaParticle getParticle() {
+        return particle;
+    }
+
+    public void setParticle(XmlSchemaParticle particle) {
+        this.particle = particle;
+    }
+
+    public String toString(String prefix, int tab) {
+        String xml = new String();
+
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+
+        if (!prefix.equals("") && prefix.indexOf(":") == -1)
+            prefix += ":";
+
+        String typeName = name != null ? name : "";
+
+        xml += "<" + prefix + "complexType name=\"" + typeName + "\">\n";
+
+        if (particle != null)
+            xml += particle.toString(prefix, (tab + 1));
+
+        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++)
+            xml += "\t";
+
+        xml += "</" + prefix + "complexType>\n";
+        return xml;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContent.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContent.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContent.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContent.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * An abstract class for schema content.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public abstract class XmlSchemaContent extends XmlSchemaAnnotated {
+
+    /**
+     * Creates new XmlSchemaContent
+     */
+    protected XmlSchemaContent() {
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentModel.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentModel.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentModel.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentModel.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * An abstract class for the schema content model.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public abstract class XmlSchemaContentModel extends XmlSchemaAnnotated {
+
+    /**
+     * Creates new XmlSchemaContentModel
+     */
+    protected XmlSchemaContentModel() {
+    }
+
+    public abstract void setContent(XmlSchemaContent content);
+
+    public abstract XmlSchemaContent getContent();
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * Provides information about the validation mode of any
+ * and anyAttribute element replacements.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaContentProcessing extends org.apache.ws.commons.schema.constants.Enum {
+
+    static String[] members = new String[]{"Lax", "None",
+                                           "Skip", "Strict"};
+
+    /**
+     * Creates new XmlSeverityType
+     */
+    public XmlSchemaContentProcessing() {
+        super();
+    }
+
+    public XmlSchemaContentProcessing(String value) {
+        super(value);
+    }
+
+    public String[] getValues() {
+        return members;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentType.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentType.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentType.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaContentType.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import org.apache.ws.commons.schema.constants.Enum;
+
+/**
+ * Enumerations for the content model of the complex type. This
+ * represents the content in the post-schema-validation infoset.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaContentType extends Enum {
+
+    static String[] members = new String[]{"ElementOnly", "Empty",
+                                           "Mixed", "TextOnly"};
+
+    /**
+     * Creates new XmlSchemaContentType
+     */
+    public XmlSchemaContentType() {
+        super();
+    }
+
+    public XmlSchemaContentType(String value) {
+        super(value);
+    }
+
+    public String[] getValues() {
+        return members;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDatatype.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDatatype.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDatatype.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDatatype.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * @author mukund
+ */
+
+public abstract class XmlSchemaDatatype {
+
+    /**
+     * Creates new XmlSchemaDatatype
+     */
+    public XmlSchemaDatatype() {
+    }
+
+    public abstract Object parseValue(Object input);
+
+    public abstract Class valueType();
+
+    public abstract XmlTokenizedType tokenizedType();
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * Provides different methods for preventing derivation.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaDerivationMethod extends org.apache.ws.commons.schema.constants.Enum {
+    static String[] members = new String[]{"All", "Empty", "Extension",
+                                           "List", "None", "Restriction",
+                                           "Substitution", "Union"};
+
+    /**
+     * Creates new XmlSeverityType
+     */
+    public XmlSchemaDerivationMethod() {
+        super();
+    }
+
+    public XmlSchemaDerivationMethod(String value) {
+        super(value);
+    }
+
+    public String[] getValues() {
+        return members;
+    }
+
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDocumentation.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDocumentation.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDocumentation.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaDocumentation.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import org.w3c.dom.NodeList;
+
+/**
+ * Class that specifies information to be read or used by humans
+ * within an annotation. Represents the World Wide Web Consortium
+ * (W3C) documentation element.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaDocumentation extends XmlSchemaObject {
+
+    /**
+     * Creates new XmlSchemaDocumentation
+     */
+    public XmlSchemaDocumentation() {
+    }
+
+    /**
+     * Provides the source of the application information.
+     */
+    String source;
+    String language;
+
+    /**
+     * Returns an array of XmlNode that represents the document text markup.
+     */
+    NodeList markup;
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public NodeList getMarkup() {
+        return markup;
+    }
+
+    public void setMarkup(NodeList markup) {
+        this.markup = markup;
+    }
+
+    public String getLanguage() {
+        return language;
+    }
+
+    public void setLanguage(String language) {
+        this.language = language;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaElement.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaElement.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaElement.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaElement.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Class for elements. Represents the World Wide Web Consortium (W3C) element element.
+ *
+ * @author mukund
+ */
+
+// October 15th - momo - initial implementation
+
+public class XmlSchemaElement extends XmlSchemaParticle implements TypeReceiver {
+
+    /**
+     * Attribute used to block a type derivation.
+     */
+    XmlSchemaDerivationMethod block;
+
+    /**
+     * The value after an element has been compiled to post-schema infoset.
+     * This value is either from the type itself or, if not defined on the type, taken from the schema element.
+     */
+    XmlSchemaDerivationMethod blockResolved;
+    XmlSchemaObjectCollection constraints;
+
+    /**
+     * Provides the default value of the element if its content
+     * is a simple type or the element's content is textOnly.
+     */
+    String defaultValue;
+    String fixedValue;
+
+    /**
+     * Returns the correct common runtime library
+     * object based upon the SchemaType for the element.
+     */
+    Object elementType;
+
+    XmlSchemaDerivationMethod finalDerivation;
+    XmlSchemaDerivationMethod finalDerivationResolved;
+
+    /**
+     * The default value is the value of the elementFormDefault attribute for the schema element containing the attribute.
+     * The default is Unqualified.
+     */
+    XmlSchemaForm form;
+    boolean isAbstract;
+    boolean isNillable;
+    String name;
+    QName qualifiedName;
+    QName refName;
+
+    /**
+     * Returns the type of the element.
+     * This can either be a complex type or a simple type.
+     */
+    XmlSchemaType schemaType;
+
+    /**
+     * QName of a built-in data type defined in this schema or another
+     * schema indicated by the specified namespace.
+     */
+    QName schemaTypeName;
+
+    /**
+     * QName of an element that can be a substitute for this element.
+     */
+    QName substitutionGroup;
+
+    /**
+     * Creates new XmlSchemaElement
+     */
+    public XmlSchemaElement() {
+        constraints = new XmlSchemaObjectCollection();
+        isAbstract = false;
+        isNillable = false;
+        form = new XmlSchemaForm(XmlSchemaForm.NONE);
+        finalDerivation = new XmlSchemaDerivationMethod("None");
+        block = new XmlSchemaDerivationMethod("None");
+    }
+
+    /**
+     * Returns a collection of constraints on the element.
+     */
+    public XmlSchemaObjectCollection getConstraints() {
+        return constraints;
+    }
+
+    public String getDefaultValue() {
+        return defaultValue;
+    }
+
+    public void setDefaultValue(String defaultValue) {
+        this.defaultValue = defaultValue;
+    }
+
+    public XmlSchemaDerivationMethod getBlock() {
+        return block;
+    }
+
+    public void setBlock(XmlSchemaDerivationMethod block) {
+        this.block = block;
+    }
+
+    public XmlSchemaDerivationMethod getFinal() {
+        return finalDerivation;
+    }
+
+    public void setFinal(XmlSchemaDerivationMethod finalDerivation) {
+        this.finalDerivation = finalDerivation;
+    }
+
+    public XmlSchemaDerivationMethod getBlockResolved() {
+        return blockResolved;
+    }
+
+    public String getFixedValue() {
+        return fixedValue;
+    }
+
+    public void setFixedValue(String fixedValue) {
+        this.fixedValue = fixedValue;
+    }
+
+    public Object getElementType() {
+        return elementType;
+    }
+
+    public XmlSchemaForm getForm() {
+        return form;
+    }
+
+    public void setForm(XmlSchemaForm form) {
+        this.form = form;
+    }
+
+    public boolean isAbstract() {
+        return isAbstract;
+    }
+
+    public void setAbstract(boolean isAbstract) {
+        this.isAbstract = isAbstract;
+    }
+
+    public boolean isNillable() {
+        return isNillable;
+    }
+
+    public void setNillable(boolean isNillable) {
+        this.isNillable = isNillable;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public QName getRefName() {
+        return refName;
+    }
+
+    public void setRefName(QName refName) {
+        this.refName = refName;
+    }
+
+    public QName getQName() {
+        return qualifiedName;
+    }
+
+    public void setQName(QName qualifiedName) {
+        this.qualifiedName = qualifiedName;
+    }
+
+    public XmlSchemaType getSchemaType() {
+        return schemaType;
+    }
+
+    public void setSchemaType(XmlSchemaType schemaType) {
+        this.schemaType = schemaType;
+    }
+
+    public QName getSchemaTypeName() {
+        return schemaTypeName;
+    }
+
+    public void setSchemaTypeName(QName schemaTypeName) {
+        this.schemaTypeName = schemaTypeName;
+    }
+
+    public QName getSubstitutionGroup() {
+        return substitutionGroup;
+    }
+
+    public void setSubstitutionGroup(QName substitutionGroup) {
+        this.substitutionGroup = substitutionGroup;
+    }
+
+    public String toString(String prefix, int tab) {
+        String xml = new String();
+
+        if (!prefix.equals("") && prefix.indexOf(":") == -1)
+            prefix += ":";
+
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+
+        xml += "<" + prefix + "element ";
+
+        if (!name.equals(""))
+            xml += "name=\"" + name + "\" ";
+
+        if (schemaTypeName != null)
+            xml += "type=\"" + schemaTypeName + "\"";
+
+        if (refName != null)
+            xml += "ref=\"" + refName + "\" ";
+
+        if (minOccurs != 1)
+            xml += "minOccurs=\"" + minOccurs + "\" ";
+
+        if (maxOccurs != 1)
+            xml += "maxOccurs=\"" + maxOccurs + "\" ";
+
+        xml += ">\n";
+
+        if (constraints != null)
+            xml += constraints.toString(prefix, (tab + 1));
+
+        if (schemaType != null) {
+            xml += schemaType.toString(prefix, (tab + 1));
+        }
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+
+        xml += "</" + prefix + "element>\n";
+
+        return xml;
+    }
+
+    public void setType(XmlSchemaType type) {
+        this.schemaType = type;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaEnumerationFacet.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaEnumerationFacet.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaEnumerationFacet.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaEnumerationFacet.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * Class for defining enumeration facets. Represents the World Wide
+ * Web Consortium (W3C) enumeration facet.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaEnumerationFacet extends XmlSchemaFacet {
+
+    /**
+     * Creates new XmlSchemaEnumerationFacet
+     */
+    public XmlSchemaEnumerationFacet() {
+    }
+
+    public XmlSchemaEnumerationFacet(Object value, boolean fixed) {
+        super(value, fixed);
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaException.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaException.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaException.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaException.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+
+/**
+ * Returns detailed information about the schema exception.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaException extends RuntimeException {
+
+    /**
+     * Creates new XmlSchemaException
+     */
+    public XmlSchemaException() {
+    }
+
+    public XmlSchemaException(String message) {
+        super(message);
+    }
+
+    // TODO :implement
+    public int getLineNumer() {
+        return 1;
+    }
+
+    public int getLinePosition() {
+        return 1;
+    }
+
+    public XmlSchemaObject getSourceSchemaObject() {
+        return null;
+    }
+
+    public String getSourceUri() {
+        return null;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaExternal.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaExternal.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaExternal.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaExternal.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * An abstract class. Provides information about the included schema.
+ *
+ * @author mukund
+ */
+
+public abstract class XmlSchemaExternal extends XmlSchemaAnnotated {
+
+    /**
+     * Creates new XmlSchemaExternal
+     */
+    protected XmlSchemaExternal() {
+    }
+
+    XmlSchema schema;
+
+    public XmlSchema getSchema() {
+        return schema;
+    }
+
+    public void setSchema(XmlSchema schema) {
+        this.schema = schema;
+    }
+
+    String schemaLocation;
+
+    public String getSchemaLocation() {
+        return schemaLocation;
+    }
+
+    public void setSchemaLocation(String schemaLocation) {
+        this.schemaLocation = schemaLocation;
+    }
+}
+