ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r290580 [5/5] - in /webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema: ./ constants/ utils/
Date Tue, 20 Sep 2005 22:55:17 GMT
Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContent.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContent.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContent.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContent.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,55 @@
+/*
+ * 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 simple types and complex types with a simple content model.
+ * Represents the World Wide Web Consortium (W3C) simpleContent element.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaSimpleContent extends XmlSchemaContentModel {
+
+    /**
+     * Creates new XmlSchemaSimpleContent
+     */
+    public XmlSchemaSimpleContent() {
+    }
+
+    /*  One of XmlSchemaSimpleContentRestriction or XmlSchemaSimpleContentExtension. */
+    XmlSchemaContent content;
+
+    public XmlSchemaContent getContent() {
+        return this.content;
+    }
+
+    public void setContent(XmlSchemaContent content) {
+        this.content = content;
+    }
+
+    public String toString(String prefix, int tab) {
+        String xml = new String();
+
+        if (!prefix.equals("") && prefix.indexOf(":") == -1) {
+            prefix += ":";
+        }
+        return xml;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.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 javax.xml.namespace.QName;
+
+
+/**
+ * Class for simple types that are derived by extension. Extends the simple
+ * type content of the element by adding attributes. Represents the World Wide
+ * Web Consortium (W3C) extension element for simple content.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaSimpleContentExtension extends XmlSchemaContent {
+
+    /**
+     * Creates new XmlSchemaSimpleContentExtension
+     */
+    public XmlSchemaSimpleContentExtension() {
+        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;
+    }
+
+}
+

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,90 @@
+/*
+ * 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 simple types that are derived by restriction. Restricts the
+ * range of values for the element to a subset of the inherited simple types.
+ * Represents the World Wide Web Consortium (W3C) restriction element for simple content.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaSimpleContentRestriction extends XmlSchemaContent {
+
+    /**
+     * Creates new XmlSchemaSimpleContentRestriction
+     */
+    public XmlSchemaSimpleContentRestriction() {
+        facets = new XmlSchemaObjectCollection();
+        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;
+    }
+
+    /*Derived from the type specified by the base value.*/
+    XmlSchemaSimpleType baseType;
+
+    public void setBaseType(XmlSchemaSimpleType baseType) {
+        this.baseType = baseType;
+    }
+
+    public XmlSchemaSimpleType getBaseType() {
+        return this.baseType;
+    }
+
+    /* 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 or more of the facet classes: */
+    XmlSchemaObjectCollection facets;
+
+    public XmlSchemaObjectCollection getFacets() {
+        return this.facets;
+    }
+
+}
+			

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleType.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleType.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleType.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleType.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,71 @@
+/*
+ * 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 defines a simple type that determines the information and
+ * constraints for the values of attributes or elements with text-only
+ * content. Represents the World Wide Web Consortium (W3C) simpleType element.
+ *
+ * @author mukund
+ */
+
+// Oct 15th - momo - initial impl
+
+public class XmlSchemaSimpleType extends XmlSchemaType {
+
+    XmlSchemaSimpleTypeContent content;
+
+    /**
+     * Creates new XmlSchemaSimpleType
+     */
+    public XmlSchemaSimpleType(XmlSchema schema) {
+        super(schema);
+    }
+
+    public XmlSchemaSimpleTypeContent getContent() {
+        return content;
+    }
+
+    public void setContent(XmlSchemaSimpleTypeContent content) {
+        this.content = content;
+    }
+
+    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 + "simpleType>\n";
+
+        if (content != null)
+            xml += content.toString(prefix, (tab + 1));
+
+        for (int i = 0; i < tab; i++)
+            xml += "\t";
+
+        xml += "</" + prefix + "simpleType>\n";
+        return xml;
+    }
+
+}
+

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeContent.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeContent.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeContent.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeContent.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * Abstract class for simple type content classes.
+ *
+ * @author mukund
+ */
+
+public abstract class XmlSchemaSimpleTypeContent extends XmlSchemaAnnotated {
+
+    /**
+     * Creates new XmlSchemaSimpleTypeContent
+     */
+    protected XmlSchemaSimpleTypeContent() {
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeList.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeList.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeList.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeList.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,57 @@
+/*
+ * 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 list of simpleType elements. Defines a simpleType element
+ * as a list of values of a specified data type. Represents the World Wide
+ * Web Consortium (W3C) list element.
+ *
+ * @author mukund
+ */
+public class XmlSchemaSimpleTypeList extends XmlSchemaSimpleTypeContent {
+
+    /**
+     * Creates new XmlSchemaSimpleTypeList
+     */
+    public XmlSchemaSimpleTypeList() {
+    }
+
+    XmlSchemaSimpleType itemType;
+
+    public XmlSchemaSimpleType getItemType() {
+        return this.itemType;
+    }
+
+    public void setItemType(XmlSchemaSimpleType itemType) {
+        this.itemType = itemType;
+    }
+
+    QName itemTypeName;
+
+    public QName getItemTypeName() {
+        return this.itemTypeName;
+    }
+
+    public void setItemTypeName(QName itemTypeName) {
+        this.itemTypeName = itemTypeName;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeRestriction.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,93 @@
+/*
+ * 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 restriction of simpleType elements. Represents the World
+ * Wide Web Consortium (W3C) restriction element for simple types.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaSimpleTypeRestriction extends XmlSchemaSimpleTypeContent {
+
+    /**
+     * Creates new XmlSchemaSimpleTypeRestriction
+     */
+    public XmlSchemaSimpleTypeRestriction() {
+        facets = new XmlSchemaObjectCollection();
+    }
+
+    XmlSchemaSimpleType baseType;
+
+    public XmlSchemaSimpleType getBaseType() {
+        return this.baseType;
+    }
+
+    public void setBaseType(XmlSchemaSimpleType baseType) {
+        this.baseType = baseType;
+    }
+
+    QName baseTypeName;
+
+    public QName getBaseTypeName() {
+        return this.baseTypeName;
+    }
+
+    public void setBaseTypeName(QName baseTypeName) {
+        this.baseTypeName = baseTypeName;
+    }
+
+    XmlSchemaObjectCollection facets;// = new XmlSchemaObjectCollection();
+
+    public XmlSchemaObjectCollection getFacets() {
+        return this.facets;
+    }
+
+    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 + "restriction ";
+
+        if (baseTypeName != null) {
+            xml += "base =\"" + baseTypeName + "\">\n";
+        } else {
+            xml += ">\n";
+            // inline def
+            xml += baseType.toString(prefix, (tab + 1));
+        }
+
+        xml += facets.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/XmlSchemaSimpleTypeUnion.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeUnion.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeUnion.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaSimpleTypeUnion.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,56 @@
+/*
+ * 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 union of simpleType elements. Defines a simpleType element
+ * as a list of values of a specified data type. Represents the World
+ * Wide Web Consortium (W3C) union element.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaSimpleTypeUnion extends XmlSchemaSimpleTypeContent {
+
+    XmlSchemaObjectCollection baseTypes;
+    String memberTypesSource;
+    QName[] memberTypesQNames;
+
+    public XmlSchemaSimpleTypeUnion() {
+        baseTypes = new XmlSchemaObjectCollection();
+    }
+
+    public XmlSchemaObjectCollection getBaseTypes() {
+        return this.baseTypes;
+    }
+
+    public void setMemberTypesSource(String memberTypesSources) {
+        this.memberTypesSource = memberTypesSources;
+    }
+
+    public String getMemberTypesSource() {
+        return this.memberTypesSource;
+    }
+
+    public QName[] getMemberTypesQNames() {
+        return this.memberTypesQNames;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaTotalDigitsFacet.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaTotalDigitsFacet.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaTotalDigitsFacet.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaTotalDigitsFacet.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 totalDigits facets. Represents the World Wide
+ * Web Consortium (W3C) totalDigits facet.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaTotalDigitsFacet extends XmlSchemaNumericFacet {
+
+    /**
+     * Creates new XmlSchemaTotalDigitsFacet
+     */
+    public XmlSchemaTotalDigitsFacet() {
+    }
+
+    public XmlSchemaTotalDigitsFacet(Object value, boolean fixed) {
+        super(value, fixed);
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaType.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaType.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaType.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaType.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,93 @@
+/*
+ * 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;
+
+
+/**
+ * The base class for all simple types and complex types.
+ *
+ * @author mukund
+ */
+
+// Oct 15th - momo - initial impl
+
+public class XmlSchemaType extends XmlSchemaAnnotated {
+
+    Object baseSchemaType;
+    XmlSchemaDatatype dataType;
+    XmlSchemaDerivationMethod deriveBy, finalDerivation, finalResolved;
+    boolean isMixed;
+
+    // name of the type
+    String name;
+
+    XmlSchema schema;
+
+    /**
+     * Creates new XmlSchemaType
+     */
+    public XmlSchemaType(XmlSchema schema) {
+        this.schema = schema;
+        finalDerivation = new XmlSchemaDerivationMethod("None");
+    }
+
+    public Object getBaseSchemaType() {
+        return baseSchemaType;
+    }
+
+    public XmlSchemaDatatype getDataType() {
+        return dataType;
+    }
+
+    public XmlSchemaDerivationMethod getDeriveBy() {
+        return deriveBy;
+    }
+
+    public XmlSchemaDerivationMethod getFinal() {
+        return finalDerivation;
+    }
+
+    public void setFinal(XmlSchemaDerivationMethod finalDerivation) {
+        this.finalDerivation = finalDerivation;
+    }
+
+    public XmlSchemaDerivationMethod getFinalResolved() {
+        return finalResolved;
+    }
+
+    public boolean isMixed() {
+        return isMixed;
+    }
+
+    public void setMixed(boolean isMixed) {
+        this.isMixed = isMixed;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public QName getQName() {
+        return new QName(schema.targetNamespace, name);
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaUnique.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaUnique.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaUnique.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaUnique.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * Identifies a unique constraint among a set of elements. Represents
+ * the World Wide Web Consortium (W3C) unique element.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaUnique extends XmlSchemaIdentityConstraint {
+
+    /**
+     * Creates new XmlSchemaUnique
+     */
+    public XmlSchemaUnique() {
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaUse.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaUse.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaUse.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaUse.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,44 @@
+/*
+ * 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;
+
+/**
+ * Indicator of how the attribute is used.
+ *
+ * @author mukund
+ */
+public class XmlSchemaUse extends org.apache.ws.commons.schema.constants.Enum {
+
+    static String[] members = new String[]{"None", "Optional",
+                                           "Prohibited", "Required"};
+
+    /**
+     * Creates new XmlSchemaUse
+     */
+    public XmlSchemaUse() {
+        super();
+    }
+
+    public XmlSchemaUse(String value) {
+        super(value);
+    }
+
+    public String[] getValues() {
+        return members;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaWhiteSpaceFacet.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaWhiteSpaceFacet.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaWhiteSpaceFacet.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaWhiteSpaceFacet.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+/*
+ * XmlSchemaWhiteSpaceFacet.java
+ *
+ * Created on September 27, 2001, 3:33 AM
+ */
+
+package org.apache.ws.commons.schema;
+
+/**
+ * Class for defining whiteSpace facets. Represents the World Wide
+ * Web Consortium (W3C) whiteSpace facet.
+ *
+ * @author mukund
+ */
+
+// Vidyanand - 16th Oct - initial implementation
+
+public class XmlSchemaWhiteSpaceFacet extends XmlSchemaFacet {
+
+    /**
+     * Creates new XmlSchemaWhiteSpaceFacet
+     */
+    public XmlSchemaWhiteSpaceFacet() {
+    }
+
+    public XmlSchemaWhiteSpaceFacet(Object value, boolean fixed) {
+        super(value, fixed);
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaXPath.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaXPath.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaXPath.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSchemaXPath.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,45 @@
+/*
+ * 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 XML Path Language (XPath) expressions. Represents the
+ * World Wide Web Consortium (W3C) selector element. The World Wide
+ * Web Consortium (W3C) field element is a collection of
+ * XmlSchemaXPath classes.
+ *
+ * @author mukund
+ */
+
+public class XmlSchemaXPath extends XmlSchemaAnnotated {
+
+    /**
+     * Creates new XmlSchemaXPath
+     */
+    public XmlSchemaXPath() {
+    }
+
+    String xpath;
+
+    public String getXPath() {
+        return xpath;
+    }
+
+    public void setXPath(String xpath) {
+        this.xpath = xpath;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSeverityType.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSeverityType.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSeverityType.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlSeverityType.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+/**
+ * Represents the severity of the validation event.
+ *
+ * @author mukund
+ */
+
+public class XmlSeverityType extends Enum {
+
+    static String[] members = new String[]{"Error", "Warning"};
+
+    /**
+     * Creates new XmlSeverityType
+     */
+    public XmlSeverityType() {
+        super();
+    }
+
+    public XmlSeverityType(String value) {
+        super(value);
+    }
+
+    public String[] getValues() {
+        return members;
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlTokenizedType.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlTokenizedType.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlTokenizedType.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/XmlTokenizedType.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;
+
+/**
+ * @author momo
+ */
+
+// Oct 15th - Momo - Initial Impl
+
+public class XmlTokenizedType extends org.apache.ws.commons.schema.constants.Enum {
+
+    static String[] members = new String[]{"CDATA", "IDREF", "IDREFS",
+                                           "ENTITY", "ENTITIES", "NMTOKEN",
+                                           "NMTOKENS", "NOTATION", "ENUMERATION",
+                                           "QName", "NCName", "None"};
+
+    /**
+     * Creates new XmlSchemaForm
+     */
+    public XmlTokenizedType(String value) {
+        super(value);
+    }
+
+    public String[] getValues() {
+        return members;
+    }
+
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/constants/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/constants/Constants.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/constants/Constants.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/constants/Constants.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,86 @@
+/*
+ * 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.constants;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Constants
+ */
+public class Constants {
+    //
+    // Schema Namespaces
+    //
+    public static final String URI_2001_SCHEMA_XSD =
+                                          "http://www.w3.org/2001/XMLSchema";
+    public static final String URI_2001_SCHEMA_XSI =
+                                 "http://www.w3.org/2001/XMLSchema-instance";
+
+    // Define qnames for the all of the XSD and SOAP-ENC encodings
+    public static final QName XSD_STRING = new QName(URI_2001_SCHEMA_XSD, "string");
+    public static final QName XSD_BOOLEAN = new QName(URI_2001_SCHEMA_XSD, "boolean");
+    public static final QName XSD_DOUBLE = new QName(URI_2001_SCHEMA_XSD, "double");
+    public static final QName XSD_FLOAT = new QName(URI_2001_SCHEMA_XSD, "float");
+    public static final QName XSD_INT = new QName(URI_2001_SCHEMA_XSD, "int");
+    public static final QName XSD_INTEGER = new QName(URI_2001_SCHEMA_XSD, "integer");
+    public static final QName XSD_LONG = new QName(URI_2001_SCHEMA_XSD, "long");
+    public static final QName XSD_SHORT = new QName(URI_2001_SCHEMA_XSD, "short");
+    public static final QName XSD_BYTE = new QName(URI_2001_SCHEMA_XSD, "byte");
+    public static final QName XSD_DECIMAL = new QName(URI_2001_SCHEMA_XSD, "decimal");
+    public static final QName XSD_BASE64 = new QName(URI_2001_SCHEMA_XSD, "base64Binary");
+    public static final QName XSD_HEXBIN = new QName(URI_2001_SCHEMA_XSD, "hexBinary");
+    public static final QName XSD_ANYSIMPLETYPE = new QName(URI_2001_SCHEMA_XSD, "anySimpleType");
+    public static final QName XSD_ANYTYPE = new QName(URI_2001_SCHEMA_XSD, "anyType");
+    public static final QName XSD_ANY = new QName(URI_2001_SCHEMA_XSD, "any");
+    public static final QName XSD_QNAME = new QName(URI_2001_SCHEMA_XSD, "QName");
+    public static final QName XSD_DATETIME = new QName(URI_2001_SCHEMA_XSD, "dateTime");
+    public static final QName XSD_DATE = new QName(URI_2001_SCHEMA_XSD, "date");
+    public static final QName XSD_TIME = new QName(URI_2001_SCHEMA_XSD, "time");
+
+    public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD, "normalizedString");
+    public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD, "token");
+
+    public static final QName XSD_UNSIGNEDLONG = new QName(URI_2001_SCHEMA_XSD, "unsignedLong");
+    public static final QName XSD_UNSIGNEDINT = new QName(URI_2001_SCHEMA_XSD, "unsignedInt");
+    public static final QName XSD_UNSIGNEDSHORT = new QName(URI_2001_SCHEMA_XSD, "unsignedShort");
+    public static final QName XSD_UNSIGNEDBYTE = new QName(URI_2001_SCHEMA_XSD, "unsignedByte");
+    public static final QName XSD_POSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "positiveInteger");
+    public static final QName XSD_NEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "negativeInteger");
+    public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonNegativeInteger");
+    public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonPositiveInteger");
+
+    public static final QName XSD_YEARMONTH = new QName(URI_2001_SCHEMA_XSD, "gYearMonth");
+    public static final QName XSD_MONTHDAY = new QName(URI_2001_SCHEMA_XSD, "gMonthDay");
+    public static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD, "gYear");
+    public static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD, "gMonth");
+    public static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD, "gDay");
+    public static final QName XSD_DURATION = new QName(URI_2001_SCHEMA_XSD, "duration");
+
+    public static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD, "Name");
+    public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD, "NCName");
+    public static final QName XSD_NMTOKEN = new QName(URI_2001_SCHEMA_XSD, "NMTOKEN");
+    public static final QName XSD_NMTOKENS = new QName(URI_2001_SCHEMA_XSD, "NMTOKENS");
+    public static final QName XSD_NOTATION = new QName(URI_2001_SCHEMA_XSD, "NOTATION");
+    public static final QName XSD_ENTITY = new QName(URI_2001_SCHEMA_XSD, "ENTITY");
+    public static final QName XSD_ENTITIES = new QName(URI_2001_SCHEMA_XSD, "ENTITIES");
+    public static final QName XSD_IDREF = new QName(URI_2001_SCHEMA_XSD, "IDREF");
+    public static final QName XSD_IDREFS = new QName(URI_2001_SCHEMA_XSD, "IDREFS");
+    public static final QName XSD_ANYURI = new QName(URI_2001_SCHEMA_XSD, "anyURI");
+    public static final QName XSD_LANGUAGE = new QName(URI_2001_SCHEMA_XSD, "language");
+    public static final QName XSD_ID = new QName(URI_2001_SCHEMA_XSD, "ID");
+    public static final QName XSD_SCHEMA = new QName(URI_2001_SCHEMA_XSD, "schema");
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/constants/Enum.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/constants/Enum.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/constants/Enum.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/constants/Enum.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,82 @@
+/*
+ * 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.constants;
+
+/**
+ * @author mukund
+ */
+
+public abstract class Enum {
+
+    public static String NULL = "NULL";
+
+    protected Enum(String value) {
+        setValue(value);
+    }
+
+    protected Enum() {
+        this(NULL);
+    }
+
+    protected abstract String[] getValues();
+
+    protected String value = NULL;
+
+    public void setValue(String value) {
+        if (value.equals(Enum.NULL))
+            this.value = Enum.NULL;
+        else {
+            String values[] = getValues();
+            for (int i = 0; i < values.length; i++) {
+                if (values[i].equals(value)) {
+                    this.value = value;
+                    break;
+                }
+                if (i == values.length - 1)
+                    throw new EnumValueException("Bad Enumeration value '" + value + "'");
+            }
+        }
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String toString() {
+        return value;
+    }
+
+    public boolean equals(Object what) {
+        return what.getClass().equals(this.getClass()) &&
+                ((Enum) what).getValue().equals(this.getValue());
+    }
+
+    public static class EnumValueException extends RuntimeException {
+        public EnumValueException(String mesg) {
+            super(mesg);
+        }
+    }
+
+    protected static final int index(String value, String values[]) {
+        for (int i = 0; i < values.length; i++) {
+            if (value.equals(values[i]))
+                return i;
+        }
+        return -1;
+    }
+}
+

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/DOMUtil.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/DOMUtil.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/DOMUtil.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/DOMUtil.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,588 @@
+/*
+ * 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.utils;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * Some useful utility methods.
+ * This class was modified in Xerces2 with a view to abstracting as
+ * much as possible away from the representation of the underlying
+ * parsed structure (i.e., the DOM).  This was done so that, if Xerces
+ * ever adopts an in-memory representation more efficient than the DOM
+ * (such as a DTM), we should easily be able to convert our schema
+ * parsing to utilize it.
+ *
+ * @version $ID DOMUtil
+ */
+public class DOMUtil {
+
+    //
+    // Constructors
+    //
+
+    /**
+     * This class cannot be instantiated.
+     */
+    protected DOMUtil() {
+    }
+
+    //
+    // Public static methods
+    //
+
+    /**
+     * Finds and returns the first child element node.
+     */
+    public static Element getFirstChildElement(Node parent) {
+
+        // search for node
+        Node child = parent.getFirstChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                return (Element) child;
+            }
+            child = child.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getFirstChildElement(Node):Element
+
+    /**
+     * Finds and returns the last child element node.
+     */
+    public static Element getLastChildElement(Node parent) {
+
+        // search for node
+        Node child = parent.getLastChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                return (Element) child;
+            }
+            child = child.getPreviousSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getLastChildElement(Node):Element
+
+
+    /**
+     * Finds and returns the next sibling element node.
+     */
+    public static Element getNextSiblingElement(Node node) {
+
+        // search for node
+        Node sibling = node.getNextSibling();
+        while (sibling != null) {
+            if (sibling.getNodeType() == Node.ELEMENT_NODE) {
+                return (Element) sibling;
+            }
+            sibling = sibling.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getNextSiblingElement(Node):Element
+
+    /**
+     * Finds and returns the first child node with the given name.
+     */
+    public static Element getFirstChildElement(Node parent, String elemName) {
+
+        // search for node
+        Node child = parent.getFirstChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                if (child.getNodeName().equals(elemName)) {
+                    return (Element) child;
+                }
+            }
+            child = child.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getFirstChildElement(Node,String):Element
+
+    /**
+     * Finds and returns the last child node with the given name.
+     */
+    public static Element getLastChildElement(Node parent, String elemName) {
+
+        // search for node
+        Node child = parent.getLastChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                if (child.getNodeName().equals(elemName)) {
+                    return (Element) child;
+                }
+            }
+            child = child.getPreviousSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getLastChildElement(Node,String):Element
+
+    /**
+     * Finds and returns the next sibling node with the given name.
+     */
+    public static Element getNextSiblingElement(Node node, String elemName) {
+
+        // search for node
+        Node sibling = node.getNextSibling();
+        while (sibling != null) {
+            if (sibling.getNodeType() == Node.ELEMENT_NODE) {
+                if (sibling.getNodeName().equals(elemName)) {
+                    return (Element) sibling;
+                }
+            }
+            sibling = sibling.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getNextSiblingdElement(Node,String):Element
+
+    /**
+     * Finds and returns the first child node with the given qualified name.
+     */
+    public static Element getFirstChildElementNS(Node parent,
+                                                 String uri, String localpart) {
+
+        // search for node
+        Node child = parent.getFirstChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                String childURI = child.getNamespaceURI();
+                if (childURI != null && childURI.equals(uri) &&
+                        child.getLocalName().equals(localpart)) {
+                    return (Element) child;
+                }
+            }
+            child = child.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getFirstChildElementNS(Node,String,String):Element
+
+    /**
+     * Finds and returns the last child node with the given qualified name.
+     */
+    public static Element getLastChildElementNS(Node parent,
+                                                String uri, String localpart) {
+
+        // search for node
+        Node child = parent.getLastChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                String childURI = child.getNamespaceURI();
+                if (childURI != null && childURI.equals(uri) &&
+                        child.getLocalName().equals(localpart)) {
+                    return (Element) child;
+                }
+            }
+            child = child.getPreviousSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getLastChildElementNS(Node,String,String):Element
+
+    /**
+     * Finds and returns the next sibling node with the given qualified name.
+     */
+    public static Element getNextSiblingElementNS(Node node,
+                                                  String uri, String localpart) {
+
+        // search for node
+        Node sibling = node.getNextSibling();
+        while (sibling != null) {
+            if (sibling.getNodeType() == Node.ELEMENT_NODE) {
+                String siblingURI = sibling.getNamespaceURI();
+                if (siblingURI != null && siblingURI.equals(uri) &&
+                        sibling.getLocalName().equals(localpart)) {
+                    return (Element) sibling;
+                }
+            }
+            sibling = sibling.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getNextSiblingdElementNS(Node,String,String):Element
+
+    /**
+     * Finds and returns the first child node with the given name.
+     */
+    public static Element getFirstChildElement(Node parent, String elemNames[]) {
+
+        // search for node
+        Node child = parent.getFirstChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                for (int i = 0; i < elemNames.length; i++) {
+                    if (child.getNodeName().equals(elemNames[i])) {
+                        return (Element) child;
+                    }
+                }
+            }
+            child = child.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getFirstChildElement(Node,String[]):Element
+
+    /**
+     * Finds and returns the last child node with the given name.
+     */
+    public static Element getLastChildElement(Node parent, String elemNames[]) {
+
+        // search for node
+        Node child = parent.getLastChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                for (int i = 0; i < elemNames.length; i++) {
+                    if (child.getNodeName().equals(elemNames[i])) {
+                        return (Element) child;
+                    }
+                }
+            }
+            child = child.getPreviousSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getLastChildElement(Node,String[]):Element
+
+    /**
+     * Finds and returns the next sibling node with the given name.
+     */
+    public static Element getNextSiblingElement(Node node, String elemNames[]) {
+
+        // search for node
+        Node sibling = node.getNextSibling();
+        while (sibling != null) {
+            if (sibling.getNodeType() == Node.ELEMENT_NODE) {
+                for (int i = 0; i < elemNames.length; i++) {
+                    if (sibling.getNodeName().equals(elemNames[i])) {
+                        return (Element) sibling;
+                    }
+                }
+            }
+            sibling = sibling.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getNextSiblingdElement(Node,String[]):Element
+
+    /**
+     * Finds and returns the first child node with the given qualified name.
+     */
+    public static Element getFirstChildElementNS(Node parent,
+                                                 String[][] elemNames) {
+
+        // search for node
+        Node child = parent.getFirstChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                for (int i = 0; i < elemNames.length; i++) {
+                    String uri = child.getNamespaceURI();
+                    if (uri != null && uri.equals(elemNames[i][0]) &&
+                            child.getLocalName().equals(elemNames[i][1])) {
+                        return (Element) child;
+                    }
+                }
+            }
+            child = child.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getFirstChildElementNS(Node,String[][]):Element
+
+    /**
+     * Finds and returns the last child node with the given qualified name.
+     */
+    public static Element getLastChildElementNS(Node parent,
+                                                String[][] elemNames) {
+
+        // search for node
+        Node child = parent.getLastChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                for (int i = 0; i < elemNames.length; i++) {
+                    String uri = child.getNamespaceURI();
+                    if (uri != null && uri.equals(elemNames[i][0]) &&
+                            child.getLocalName().equals(elemNames[i][1])) {
+                        return (Element) child;
+                    }
+                }
+            }
+            child = child.getPreviousSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getLastChildElementNS(Node,String[][]):Element
+
+    /**
+     * Finds and returns the next sibling node with the given qualified name.
+     */
+    public static Element getNextSiblingElementNS(Node node,
+                                                  String[][] elemNames) {
+
+        // search for node
+        Node sibling = node.getNextSibling();
+        while (sibling != null) {
+            if (sibling.getNodeType() == Node.ELEMENT_NODE) {
+                for (int i = 0; i < elemNames.length; i++) {
+                    String uri = sibling.getNamespaceURI();
+                    if (uri != null && uri.equals(elemNames[i][0]) &&
+                            sibling.getLocalName().equals(elemNames[i][1])) {
+                        return (Element) sibling;
+                    }
+                }
+            }
+            sibling = sibling.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getNextSiblingdElementNS(Node,String[][]):Element
+
+    /**
+     * Finds and returns the first child node with the given name and
+     * attribute name, value pair.
+     */
+    public static Element getFirstChildElement(Node parent,
+                                               String elemName,
+                                               String attrName,
+                                               String attrValue) {
+
+        // search for node
+        Node child = parent.getFirstChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                Element element = (Element) child;
+                if (element.getNodeName().equals(elemName) &&
+                        element.getAttribute(attrName).equals(attrValue)) {
+                    return element;
+                }
+            }
+            child = child.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getFirstChildElement(Node,String,String,String):Element
+
+    /**
+     * Finds and returns the last child node with the given name and
+     * attribute name, value pair.
+     */
+    public static Element getLastChildElement(Node parent,
+                                              String elemName,
+                                              String attrName,
+                                              String attrValue) {
+
+        // search for node
+        Node child = parent.getLastChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                Element element = (Element) child;
+                if (element.getNodeName().equals(elemName) &&
+                        element.getAttribute(attrName).equals(attrValue)) {
+                    return element;
+                }
+            }
+            child = child.getPreviousSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getLastChildElement(Node,String,String,String):Element
+
+    /**
+     * Finds and returns the next sibling node with the given name and
+     * attribute name, value pair. Since only elements have attributes,
+     * the node returned will be of type Node.ELEMENT_NODE.
+     */
+    public static Element getNextSiblingElement(Node node,
+                                                String elemName,
+                                                String attrName,
+                                                String attrValue) {
+
+        // search for node
+        Node sibling = node.getNextSibling();
+        while (sibling != null) {
+            if (sibling.getNodeType() == Node.ELEMENT_NODE) {
+                Element element = (Element) sibling;
+                if (element.getNodeName().equals(elemName) &&
+                        element.getAttribute(attrName).equals(attrValue)) {
+                    return element;
+                }
+            }
+            sibling = sibling.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    } // getNextSiblingElement(Node,String,String,String):Element
+
+    /**
+     * Returns the concatenated child text of the specified node.
+     * This method only looks at the immediate children of type
+     * <code>Node.TEXT_NODE</code> or the children of any child
+     * node that is of type <code>Node.CDATA_SECTION_NODE</code>
+     * for the concatenation.
+     *
+     * @param node The node to look at.
+     */
+    public static String getChildText(Node node) {
+
+        // is there anything to do?
+        if (node == null) {
+            return null;
+        }
+
+        // concatenate children text
+        StringBuffer str = new StringBuffer();
+        Node child = node.getFirstChild();
+        while (child != null) {
+            short type = child.getNodeType();
+            if (type == Node.TEXT_NODE) {
+                str.append(child.getNodeValue());
+            } else if (type == Node.CDATA_SECTION_NODE) {
+                str.append(getChildText(child));
+            }
+            child = child.getNextSibling();
+        }
+
+        // return text value
+        return str.toString();
+
+    } // getChildText(Node):String
+
+    // return the name of this element
+    public static String getName(Node node) {
+        return node.getNodeName();
+    } // getLocalName(Element):  String
+
+    /**
+     * returns local name of this element if not null, otherwise
+     * returns the name of the node
+     */
+    public static String getLocalName(Node node) {
+        String name = node.getLocalName();
+        return (name != null) ? name : node.getNodeName();
+    } // getLocalName(Element):  String
+
+    public static Element getParent(Element elem) {
+        Node parent = elem.getParentNode();
+        if (parent instanceof Element)
+            return (Element) parent;
+        return null;
+    } // getParent(Element):Element
+
+    // get the Document of which this Node is a part
+    public static Document getDocument(Node node) {
+        return node.getOwnerDocument();
+    } // getDocument(Node):Document
+
+    // return this Document's root node
+    public static Element getRoot(Document doc) {
+        return doc.getDocumentElement();
+    } // getRoot(Document(:  Element
+
+    // some methods for handling attributes:
+
+    // return the right attribute node
+    public static Attr getAttr(Element elem, String name) {
+        return elem.getAttributeNode(name);
+    } // getAttr(Element, String):Attr
+
+    // return the right attribute node
+    public static Attr getAttrNS(Element elem, String nsUri,
+                                 String localName) {
+        return elem.getAttributeNodeNS(nsUri, localName);
+    } // getAttrNS(Element, String):Attr
+
+    // get all the attributes for an Element
+    public static Attr[] getAttrs(Element elem) {
+        NamedNodeMap attrMap = elem.getAttributes();
+        Attr[] attrArray = new Attr[attrMap.getLength()];
+        for (int i = 0; i < attrMap.getLength(); i++)
+            attrArray[i] = (Attr) attrMap.item(i);
+        return attrArray;
+    } // getAttrs(Element):  Attr[]
+
+    // get attribute's value
+    public static String getValue(Attr attribute) {
+        return attribute.getValue();
+    } // getValue(Attr):String
+
+    // It is noteworthy that, because of the way the DOM specs
+    // work, the next two methods return the empty string (not
+    // null!) when the attribute with the specified name does not
+    // exist on an element.  Beware!
+
+    // return the value of the attribute of the given element
+    // with the given name
+    public static String getAttrValue(Element elem, String name) {
+        return elem.getAttribute(name);
+    } // getAttr(Element, String):Attr
+
+    // return the value of the attribute of the given element
+    // with the given name
+    public static String getAttrValueNS(Element elem, String nsUri,
+                                        String localName) {
+        return elem.getAttributeNS(nsUri, localName);
+    } // getAttrValueNS(Element, String):Attr
+
+    // return the namespace URI
+    public static String getNamespaceURI(Node node) {
+        return node.getNamespaceURI();
+    }
+} // class XUtil

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/Tokenizer.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/Tokenizer.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/Tokenizer.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/Tokenizer.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,60 @@
+/*
+ * 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.utils;
+
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ * @author mukund
+ */
+
+public class Tokenizer {
+
+    /**
+     * Cannot create new Tokenizer
+     */
+    private Tokenizer() {
+    }
+
+    public static final String[] tokenize(String in, String delim) {
+        Vector tmp = new Vector();
+        StringTokenizer stk = new StringTokenizer(in, delim);
+        while (stk.hasMoreTokens()) {
+            String str = stk.nextToken();
+            if (str.trim().length() != 0)
+                tmp.addElement(str);
+        }
+        return (String[]) tmp.toArray(new String[tmp.size()]);
+    }
+
+    public static final String[] firstToken(String in, String delim) {
+        int x = in.indexOf(delim);
+        if (x == -1)
+            return new String[]{in, ""};
+        return new String[]{in.substring(0, x),
+                            in.substring(x + delim.length(), in.length())};
+    }
+
+    public static final String[] lastToken(String in, String delim) {
+        int x = in.lastIndexOf(delim);
+        if (x == -1)
+            return new String[]{"", in};
+        return new String[]{in.substring(0, x),
+                            in.substring(x + delim.length(), in.length())};
+    }
+}

Added: webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/XDOMUtil.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/XDOMUtil.java?rev=290580&view=auto
==============================================================================
--- webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/XDOMUtil.java (added)
+++ webservices/commons/trunk/XmlSchema/src/org/apache/ws/commons/schema/utils/XDOMUtil.java Tue Sep 20 15:55:02 2005
@@ -0,0 +1,71 @@
+/*
+ * 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.utils;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.apache.ws.commons.schema.utils.DOMUtil;
+
+/**
+ * @author mukund
+ */
+public class XDOMUtil extends DOMUtil {
+
+    /**
+     * Creates a new instance of XDOMUtil
+     */
+    private XDOMUtil() {
+    }
+
+    public static Element getFirstChildElementNS(Node parent, String uri) {
+
+        // search for node
+        Node child = parent.getFirstChild();
+        while (child != null) {
+            if (child.getNodeType() == Node.ELEMENT_NODE) {
+                String childURI = child.getNamespaceURI();
+                if (childURI != null && childURI.equals(uri)) {
+                    return (Element) child;
+                }
+            }
+            child = child.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    }
+
+    public static Element getNextSiblingElementNS(Node node, String uri) {
+        // search for node
+        Node sibling = node.getNextSibling();
+        while (sibling != null) {
+            if (sibling.getNodeType() == Node.ELEMENT_NODE) {
+                String siblingURI = sibling.getNamespaceURI();
+                if (siblingURI != null && siblingURI.equals(uri)) {
+                    return (Element) sibling;
+                }
+            }
+            sibling = sibling.getNextSibling();
+        }
+
+        // not found
+        return null;
+
+    }
+
+}



Mime
View raw message