Author: bimargulies Date: Sat Dec 20 16:32:31 2008 New Revision: 728367 URL: http://svn.apache.org/viewvc?rev=728367&view=rev Log: Use Java5 enums. Eliminate some dead code for never-implemented features, leaving thus space for some future effort in the same area.
Added: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/EnumUtil.java (with props) Removed: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDatatype.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlTokenizedType.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/constants/Enum.java Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaForm.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaUse.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSeverityType.java webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/constants/Constants.java webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentExtensionTest.java webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentRestrictionTest.java Added: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/EnumUtil.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/EnumUtil.java?rev=728367&view=auto ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/EnumUtil.java (added) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/EnumUtil.java Sat Dec 20 16:32:31 2008 @@ -0,0 +1,34 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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; + +/** + * + */ +public final class EnumUtil { + private EnumUtil() { + + } + + static <T extends Enum<T>> T valueOf(Class<T> enumClass, String name) { + return Enum.valueOf(enumClass, name.toUpperCase()); + } + +} Propchange: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/EnumUtil.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/EnumUtil.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java Sat Dec 20 16:32:31 2008 @@ -144,36 +144,28 @@ return xmlSchema; } - // Check value entered by user and change according to .net spec, - // according to w3c spec have to be "#all" - // but in .net the valid enum value is "all". XmlSchemaDerivationMethod getDerivation(Element el, String attrName) { if (el.hasAttribute(attrName) && !el.getAttribute(attrName).equals("")) { - // #all | List of (extension | restriction | substitution + // #all | List of (extension | restriction | substitution) String derivationMethod = el.getAttribute(attrName).trim(); - if ("#all".equals(derivationMethod)) { - return new XmlSchemaDerivationMethod(Constants.BlockConstants.ALL); - } else { - return new XmlSchemaDerivationMethod(derivationMethod); - } + return XmlSchemaDerivationMethod.schemaValueOf(derivationMethod); } - return new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); + return XmlSchemaDerivationMethod.NONE; } - // Check value entered by user and change according to .net spec, user String getEnumString(Element el, String attrName) { if (el.hasAttribute(attrName)) { return el.getAttribute(attrName).trim(); } - return Constants.BlockConstants.NONE; + return "none"; // local convention for empty value. } XmlSchemaForm getFormDefault(Element el, String attrName) { if (el.getAttributeNode(attrName) != null) { String value = el.getAttribute(attrName); - return new XmlSchemaForm(value); + return XmlSchemaForm.schemaValueOf(value); } else { - return new XmlSchemaForm("unqualified"); + return XmlSchemaForm.UNQUALIFIED; } } @@ -325,22 +317,12 @@ } if (complexEl.hasAttribute("block")) { String blockStr = complexEl.getAttribute("block"); - if (blockStr.equalsIgnoreCase("all") | blockStr.equalsIgnoreCase("#all")) { - - ct.setBlock(new XmlSchemaDerivationMethod(Constants.BlockConstants.ALL)); - } else { - ct.setBlock(new XmlSchemaDerivationMethod(blockStr)); - // ct.setBlock(new XmlSchemaDerivationMethod(block)); - } + ct.setBlock(XmlSchemaDerivationMethod.schemaValueOf(blockStr)); + // ct.setBlock(new XmlSchemaDerivationMethod(block)); } if (complexEl.hasAttribute("final")) { String finalstr = complexEl.getAttribute("final"); - if (finalstr.equalsIgnoreCase("all") | finalstr.equalsIgnoreCase("#all")) { - - ct.setFinal(new XmlSchemaDerivationMethod(Constants.BlockConstants.ALL)); - } else { - ct.setFinal(new XmlSchemaDerivationMethod(finalstr)); - } + ct.setFinal(XmlSchemaDerivationMethod.schemaValueOf(finalstr)); } if (complexEl.hasAttribute("abstract")) { String abs = complexEl.getAttribute("abstract"); @@ -403,7 +385,7 @@ // String namespace = (schema.targetNamespace==null)? // "" : schema.targetNamespace; - boolean isQualified = schema.getElementFormDefault().getValue().equals(XmlSchemaForm.QUALIFIED); + boolean isQualified = schema.getElementFormDefault() == XmlSchemaForm.QUALIFIED; isQualified = handleElementForm(el, element, isQualified); handleElementName(isGlobal, element, isQualified); @@ -540,8 +522,8 @@ private boolean handleElementForm(Element el, XmlSchemaElement element, boolean isQualified) { if (el.hasAttribute("form")) { String formDef = el.getAttribute("form"); - element.form = new XmlSchemaForm(formDef); - isQualified = formDef.equals(XmlSchemaForm.QUALIFIED); + element.form = XmlSchemaForm.schemaValueOf(formDef); + isQualified = element.form == XmlSchemaForm.QUALIFIED; } return isQualified; } @@ -819,12 +801,7 @@ private void handleSimpleTypeFinal(Element simpleEl, XmlSchemaSimpleType simpleType) { if (simpleEl.hasAttribute("final")) { String finalstr = simpleEl.getAttribute("final"); - - if (finalstr.equalsIgnoreCase("all") | finalstr.equalsIgnoreCase("#all")) { - simpleType.setFinal(new XmlSchemaDerivationMethod(Constants.BlockConstants.ALL)); - } else { - simpleType.setFinal(new XmlSchemaDerivationMethod(finalstr)); - } + simpleType.setFinal(XmlSchemaDerivationMethod.schemaValueOf(finalstr)); } } @@ -1125,7 +1102,7 @@ if (anyEl.hasAttribute("processContents")) { String processContent = getEnumString(anyEl, "processContents"); - any.processContent = new XmlSchemaContentProcessing(processContent); + any.processContent = XmlSchemaContentProcessing.schemaValueOf(processContent); } Element annotationEl = XDOMUtil.getFirstChildElementNS(anyEl, XmlSchema.SCHEMA_NS, "annotation"); @@ -1153,7 +1130,7 @@ String contentProcessing = getEnumString(anyAttrEl, "processContents"); - anyAttr.processContent = new XmlSchemaContentProcessing(contentProcessing); + anyAttr.processContent = XmlSchemaContentProcessing.schemaValueOf(contentProcessing); } if (anyAttrEl.hasAttribute("id")) { anyAttr.id = anyAttrEl.getAttribute("id"); @@ -1205,7 +1182,7 @@ attr.name = name; } - boolean isQualified = schema.getAttributeFormDefault().getValue().equals(XmlSchemaForm.QUALIFIED); + boolean isQualified = schema.getAttributeFormDefault() == XmlSchemaForm.QUALIFIED; if (attr.name != null) { final String name = attr.name; if (topLevel) { @@ -1230,15 +1207,16 @@ if (attrEl.hasAttribute("form")) { String formValue = getEnumString(attrEl, "form"); - attr.form = new XmlSchemaForm(formValue); + attr.form = XmlSchemaForm.schemaValueOf(formValue); } + if (attrEl.hasAttribute("id")) { attr.id = attrEl.getAttribute("id"); } if (attrEl.hasAttribute("use")) { String useType = getEnumString(attrEl, "use"); - attr.use = new XmlSchemaUse(useType); + attr.use = XmlSchemaUse.schemaValueOf(useType); } if (attrEl.hasAttribute("ref")) { String name = attrEl.getAttribute("ref"); Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchema.java Sat Dec 20 16:32:31 2008 @@ -42,7 +42,6 @@ import org.w3c.dom.Document; import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException; -import org.apache.ws.commons.schema.constants.Constants; import org.apache.ws.commons.schema.utils.NamespaceContextOwner; import org.apache.ws.commons.schema.utils.NamespacePrefixList; @@ -108,10 +107,10 @@ */ public XmlSchema(String namespace, String systemId, XmlSchemaCollection parent) { this.parent = parent; - attributeFormDefault = new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); - elementFormDefault = new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED); - blockDefault = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); - finalDefault = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); + attributeFormDefault = XmlSchemaForm.UNQUALIFIED; + elementFormDefault = XmlSchemaForm.UNQUALIFIED; + blockDefault = XmlSchemaDerivationMethod.NONE; + finalDefault = XmlSchemaDerivationMethod.NONE; items = new XmlSchemaObjectCollection(); includes = new XmlSchemaObjectCollection(); elements = new XmlSchemaObjectTable(); Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAny.java Sat Dec 20 16:32:31 2008 @@ -19,8 +19,6 @@ package org.apache.ws.commons.schema; -import org.apache.ws.commons.schema.constants.Constants; - /** * Enables any element from the specified namespace or namespaces to appear in the containing complexType * element. Represents the World Wide Web Consortium (W3C) any element. @@ -39,7 +37,7 @@ * Creates new XmlSchemaAny */ public XmlSchemaAny() { - processContent = new XmlSchemaContentProcessing(Constants.BlockConstants.NONE); + processContent = XmlSchemaContentProcessing.NONE; } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAnyAttribute.java Sat Dec 20 16:32:31 2008 @@ -19,8 +19,6 @@ package org.apache.ws.commons.schema; -import org.apache.ws.commons.schema.constants.Constants; - /** * Enables any attribute from the specified namespace or namespaces to appear in the containing complexType * element. Represents the World Wide Web Consortium (W3C) anyAttribute element. @@ -33,7 +31,7 @@ * Creates new XmlSchemaAnyAttribute */ public XmlSchemaAnyAttribute() { - processContent = new XmlSchemaContentProcessing(Constants.BlockConstants.NONE); + processContent = XmlSchemaContentProcessing.NONE; } public String getNamespace() { Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java Sat Dec 20 16:32:31 2008 @@ -21,8 +21,6 @@ import javax.xml.namespace.QName; -import org.apache.ws.commons.schema.constants.Constants; - /** * Class for attribute types. Represents the World Wide Web Consortium (W3C) attribute element. */ @@ -45,8 +43,8 @@ * Creates new XmlSchemaAttribute */ public XmlSchemaAttribute() { - form = new XmlSchemaForm(XmlSchemaForm.NONE); - use = new XmlSchemaUse(Constants.BlockConstants.NONE); + form = XmlSchemaForm.NONE; + use = XmlSchemaUse.NONE; } public Object getAttributeType() { Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java Sat Dec 20 16:32:31 2008 @@ -21,8 +21,6 @@ import javax.xml.namespace.QName; -import org.apache.ws.commons.schema.constants.Constants; - /** * Class for complex types. Defines a complex type that determines the set of attributes and content of an * element. Represents the World Wide Web Consortium (W3C) complexType element. @@ -48,7 +46,7 @@ public XmlSchemaComplexType(XmlSchema schema) { super(schema); attributes = new XmlSchemaObjectCollection(); - block = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); + block = XmlSchemaDerivationMethod.NONE; isAbstract = false; isMixed = false; } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentProcessing.java Sat Dec 20 16:32:31 2008 @@ -19,32 +19,19 @@ package org.apache.ws.commons.schema; -import org.apache.ws.commons.schema.constants.Constants; - /** * Provides information about the validation mode of any and anyAttribute element replacements. */ -public class XmlSchemaContentProcessing extends org.apache.ws.commons.schema.constants.Enum { - - static String[] members = new String[] { - Constants.BlockConstants.LAX, Constants.BlockConstants.NONE, Constants.BlockConstants.SKIP, - Constants.BlockConstants.STRICT - }; - - /** - * Creates new XmlSeverityType - */ - public XmlSchemaContentProcessing() { - super(); +public enum XmlSchemaContentProcessing { + LAX, NONE, SKIP, STRICT; + + public static XmlSchemaContentProcessing schemaValueOf(String name) { + return EnumUtil.valueOf(XmlSchemaContentProcessing.class, name); } - public XmlSchemaContentProcessing(String value) { - super(value); + @Override + public String toString() { + return super.toString().toLowerCase(); } - - public String[] getValues() { - return members; - } - } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaContentType.java Sat Dec 20 16:32:31 2008 @@ -19,33 +19,23 @@ package org.apache.ws.commons.schema; -import org.apache.ws.commons.schema.constants.Constants; -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. */ -public class XmlSchemaContentType extends Enum { - - static String[] members = new String[] { - Constants.BlockConstants.ELEMENT_ONLY, Constants.BlockConstants.EMPTY, - Constants.BlockConstants.MIXED, Constants.BlockConstants.TEXT_ONLY - }; - - /** - * Creates new XmlSchemaContentType - */ - public XmlSchemaContentType() { - super(); - } +public enum XmlSchemaContentType { + ELEMENT_ONLY, + EMPTY, + MIXED, + TEXT_ONLY; - public XmlSchemaContentType(String value) { - super(value); + public static XmlSchemaContentProcessing schemaValueOf(String name) { + return EnumUtil.valueOf(XmlSchemaContentProcessing.class, name); } - public String[] getValues() { - return members; + @Override + public String toString() { + return super.toString().toLowerCase(); } } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaDerivationMethod.java Sat Dec 20 16:32:31 2008 @@ -19,31 +19,163 @@ package org.apache.ws.commons.schema; -import org.apache.ws.commons.schema.constants.Constants; /** - * Provides different methods for preventing derivation. + * Values for block and final attributes. Generally, either no value {...@link #isNone()} returns true), + * {...@link #isAll()} returns true, or any number of the other booleans return true. */ -public class XmlSchemaDerivationMethod extends org.apache.ws.commons.schema.constants.Enum { - static String[] members = new String[] { - Constants.BlockConstants.ALL, Constants.BlockConstants.EMPTY, Constants.BlockConstants.EXTENSION, - Constants.BlockConstants.LIST, Constants.BlockConstants.NONE, Constants.BlockConstants.RESTRICTION, - Constants.BlockConstants.SUBSITUTION, Constants.BlockConstants.UNION - }; - - /** - * Creates new XmlSeverityType - */ +public class XmlSchemaDerivationMethod { + public static final XmlSchemaDerivationMethod NONE = new XmlSchemaDerivationMethod(); + + private boolean all; + private boolean empty; + private boolean extension; + private boolean list; + private boolean restriction; + private boolean substitution; + private boolean union; + + + public XmlSchemaDerivationMethod() { - super(); + } + + //TODO: not all contexts accept all these possibilities. Enforce here? + public static XmlSchemaDerivationMethod schemaValueOf(String name) { + String[] tokens = name.split("\\s"); + XmlSchemaDerivationMethod method = new XmlSchemaDerivationMethod(); + for (String t : tokens) { + if ("#all".equalsIgnoreCase(t) || "all".equalsIgnoreCase(t)) { + if (method.notAll()) { + throw new XmlSchemaException("Derivation method cannot be #all and something else."); + } else { + method.setAll(true); + } + } else { + if (method.isAll()) { + throw new XmlSchemaException("Derivation method cannot be #all and something else."); + } + if ("extension".equals(t)) { + method.setExtension(true); + } else if ("list".equals(t)) { + method.setList(true); + } else if ("restriction".equals(t)) { + method.setRestriction(true); + } else if ("substitution".equals(t)) { + method.setSubstitution(true); + } else if ("union".equals(t)) { + method.setUnion(true); + } + } + } + return method; + } + + @Override + public String toString() { + if (isAll()) { + return "#all"; + } else { + StringBuilder sb = new StringBuilder(); + if (isExtension()) { + sb.append("extension "); + } + if (isList()) { + sb.append("list "); + } + if (isRestriction()) { + sb.append("restriction "); + } + if (isSubstitution()) { + sb.append("substitution "); + } + if (isUnion()) { + sb.append("union "); + } + return sb.toString().trim(); + } + } + + public boolean notAll() { + return empty | extension | list | restriction | substitution | union; + } + + + public boolean isAll() { + return all; + } + + public void setAll(boolean all) { + this.all = all; + if (all) { + empty = false; + extension = false; + list = false; + restriction = false; + substitution = false; + union = false; + } + } + + public boolean isEmpty() { + return empty; + } + + public void setEmpty(boolean empty) { + this.empty = empty; + } + + public boolean isExtension() { + return extension; + } + + public void setExtension(boolean extension) { + this.extension = extension; } - public XmlSchemaDerivationMethod(String value) { - super(value); + public boolean isList() { + return list; } - public String[] getValues() { - return members; + public void setList(boolean list) { + this.list = list; } + public boolean isNone() { + return !(all || empty || extension || list || restriction || substitution || union); + } + + public void setNone(boolean none) { + all = false; + empty = false; + extension = false; + list = false; + restriction = false; + substitution = false; + union = false; + } + + public boolean isRestriction() { + return restriction; + } + + public void setRestriction(boolean restriction) { + this.restriction = restriction; + } + + public boolean isSubstitution() { + return substitution; + } + + public void setSubstitution(boolean substitution) { + this.substitution = substitution; + } + + public boolean isUnion() { + return union; + } + + public void setUnion(boolean union) { + this.union = union; + } } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaElement.java Sat Dec 20 16:32:31 2008 @@ -21,8 +21,6 @@ import javax.xml.namespace.QName; -import org.apache.ws.commons.schema.constants.Constants; - /** * Class for elements. Represents the World Wide Web Consortium (W3C) element element. */ @@ -90,9 +88,9 @@ constraints = new XmlSchemaObjectCollection(); abstractElement = false; nillable = false; - form = new XmlSchemaForm(XmlSchemaForm.NONE); - finalDerivation = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); - block = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); + form = XmlSchemaForm.NONE; + finalDerivation = XmlSchemaDerivationMethod.NONE; + block = XmlSchemaDerivationMethod.NONE; } /** Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaForm.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaForm.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaForm.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaForm.java Sat Dec 20 16:32:31 2008 @@ -19,35 +19,22 @@ package org.apache.ws.commons.schema; -import org.apache.ws.commons.schema.constants.Enum; - /** * Indicates if attributes or elements need to be qualified or left unqualified. */ -public class XmlSchemaForm extends Enum { - - public static final String NONE = "none"; - public static final String QUALIFIED = "qualified"; - public static final String UNQUALIFIED = "unqualified"; - - static String[] members = new String[] { - NONE, QUALIFIED, UNQUALIFIED - }; - - /** - * Creates new XmlSchemaForm - */ - public XmlSchemaForm() { - super(); - } - - public XmlSchemaForm(String value) { - super(value); +public enum XmlSchemaForm { + NONE, + QUALIFIED, + UNQUALIFIED; + + public static XmlSchemaForm schemaValueOf(String name) { + return EnumUtil.valueOf(XmlSchemaForm.class, name); } - public String[] getValues() { - return members; + @Override + public String toString() { + return super.toString().toLowerCase(); } } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java Sat Dec 20 16:32:31 2008 @@ -255,13 +255,10 @@ anyEl.setAttribute("namespace", anyObj.namespace); } - if (anyObj.processContent != null) { - String value = anyObj.processContent.getValue(); - if (!value.equals(Constants.BlockConstants.NONE)) { - String processContent = convertString(value); - anyEl.setAttribute("processContents", processContent); - } + if (anyObj.processContent != null && anyObj.processContent != XmlSchemaContentProcessing.NONE) { + anyEl.setAttribute("processContents", anyObj.processContent.toString()); } + if (anyObj.annotation != null) { Element annotation = serializeAnnotation(doc, anyObj.annotation, schema); anyEl.appendChild(annotation); @@ -299,12 +296,9 @@ anyAttribute.setAttribute("id", anyAttributeObj.id); } - if (anyAttributeObj.processContent != null) { - String processContent = anyAttributeObj.processContent.getValue(); - if (!Constants.BlockConstants.NONE.equals(processContent)) { - processContent = convertString(processContent); - anyAttribute.setAttribute("processContents", processContent); - } + if (anyAttributeObj.processContent != null + && anyAttributeObj.processContent != XmlSchemaContentProcessing.NONE) { + anyAttribute.setAttribute("processContents", anyAttributeObj.processContent.toString()); } if (anyAttributeObj.annotation != null) { Element annotation = serializeAnnotation(doc, anyAttributeObj.annotation, schema); @@ -390,20 +384,18 @@ attribute.setAttribute("fixed", attributeObj.fixedValue); } - String formType = attributeObj.form.getValue(); - if (!formType.equals(XmlSchemaForm.NONE)) { - formType = convertString(formType); - attribute.setAttribute("form", formType); + if (attributeObj.form != XmlSchemaForm.NONE) { + attribute.setAttribute("form", attributeObj.form.toString()); } + if (attributeObj.id != null) { attribute.setAttribute("id", attributeObj.id); } - String useType = attributeObj.use.getValue(); - if (!useType.equals(Constants.BlockConstants.NONE)) { - useType = convertString(useType); - attribute.setAttribute("use", useType); + if (attributeObj.use != null && attributeObj.use != XmlSchemaUse.NONE) { + attribute.setAttribute("use", attributeObj.use.toString()); } + if (attributeObj.annotation != null) { Element annotation = serializeAnnotation(doc, attributeObj.annotation, schema); attribute.appendChild(annotation); @@ -919,15 +911,13 @@ serializedComplexType.appendChild(group); } - String block = complexTypeObj.block.getValue(); - if (!block.equals(Constants.BlockConstants.NONE)) { - block = convertString(block); - serializedComplexType.setAttribute("block", block); - } - String finalDerivation = complexTypeObj.finalDerivation.getValue(); - if (!finalDerivation.equals(Constants.BlockConstants.NONE)) { - finalDerivation = convertString(finalDerivation); - serializedComplexType.setAttribute("final", finalDerivation); + if (complexTypeObj.block != null && complexTypeObj.block != XmlSchemaDerivationMethod.NONE) { + serializedComplexType.setAttribute("block", complexTypeObj.toString()); + } + + if (complexTypeObj.finalDerivation != null + && complexTypeObj.finalDerivation != XmlSchemaDerivationMethod.NONE) { + serializedComplexType.setAttribute("final", complexTypeObj.finalDerivation.toString()); } XmlSchemaObjectCollection attrColl = complexTypeObj.attributes; @@ -1034,29 +1024,25 @@ serializedEl.setAttribute("abstract", "true"); } - String block = elementObj.block.getValue(); - if (!block.equals(Constants.BlockConstants.NONE)) { - block = convertString(block); - serializedEl.setAttribute("block", block); + if (elementObj.block != null && elementObj.block != XmlSchemaDerivationMethod.NONE) { + serializedEl.setAttribute("block", elementObj.block.toString()); } if (elementObj.defaultValue != null) { serializedEl.setAttribute("default", elementObj.defaultValue); } - String finalDerivation = elementObj.finalDerivation.getValue(); - if (!finalDerivation.equals(Constants.BlockConstants.NONE)) { - finalDerivation = convertString(finalDerivation); - serializedEl.setAttribute("final", finalDerivation); + if (elementObj.finalDerivation != null + && elementObj.finalDerivation != XmlSchemaDerivationMethod.NONE) { + serializedEl.setAttribute("final", elementObj.finalDerivation.toString()); } if (elementObj.fixedValue != null) { serializedEl.setAttribute("fixed", elementObj.fixedValue); } - String formDef = elementObj.form.getValue(); - if (!formDef.equals(XmlSchemaForm.NONE)) { - formDef = convertString(formDef); - serializedEl.setAttribute("form", formDef); + if (elementObj.form != XmlSchemaForm.NONE) { + serializedEl.setAttribute("form", elementObj.form.toString()); } + if (elementObj.id != null) { serializedEl.setAttribute("id", elementObj.id); } @@ -1574,49 +1560,37 @@ } // todo: implement xml:lang, - if (schemaObj.attributeFormDefault != null) { - String formQualified = schemaObj.attributeFormDefault.getValue(); - - if (!formQualified.equals(XmlSchemaForm.NONE)) { - serializedSchema.setAttribute("attributeFormDefault", convertString(formQualified)); - } + if (schemaObj.attributeFormDefault != null && schemaObj.attributeFormDefault != XmlSchemaForm.NONE) { + serializedSchema.setAttribute("attributeFormDefault", + schemaObj.attributeFormDefault.toString()); } - if (schemaObj.elementFormDefault != null) { - String formQualified = schemaObj.elementFormDefault.getValue(); - - if (!formQualified.equals(XmlSchemaForm.NONE)) { - serializedSchema.setAttribute("elementFormDefault", convertString(formQualified)); - } + if (schemaObj.elementFormDefault != null && schemaObj.elementFormDefault != XmlSchemaForm.NONE) { + serializedSchema.setAttribute("elementFormDefault", schemaObj.elementFormDefault.toString()); } if (schemaObj.annotation != null) { Element annotation = serializeAnnotation(serializedSchemaDocs, schemaObj.annotation, schemaObj); serializedSchema.appendChild(annotation); } + if (schemaObj.id != null) { serializedSchema.setAttribute("id", schemaObj.id); } - if (schemaObj.blockDefault != null) { - String blockDefault = schemaObj.blockDefault.getValue(); - if (!blockDefault.equals(Constants.BlockConstants.NONE)) { - blockDefault = convertString(blockDefault); - serializedSchema.setAttribute("blockDefault", blockDefault); - } - } - if (schemaObj.finalDefault != null) { - String finalDefault = schemaObj.finalDefault.getValue(); - if (!finalDefault.equals(Constants.BlockConstants.NONE)) { - finalDefault = convertString(finalDefault); - serializedSchema.setAttribute("finalDefault", finalDefault); - } + + if (schemaObj.blockDefault != null && schemaObj.blockDefault != XmlSchemaDerivationMethod.NONE) { + serializedSchema.setAttribute("blockDefault", schemaObj.blockDefault.toString()); + } + + if (schemaObj.finalDefault != null && schemaObj.finalDefault != XmlSchemaDerivationMethod.NONE) { + serializedSchema.setAttribute("finalDefault", schemaObj.finalDefault.toString()); } if (schemaObj.version != null) { serializedSchema.setAttribute("version", schemaObj.version); } - // add the extra namespace decalarations if any are available + // add the extra namespace declarations if any are available NamespacePrefixList ctx = schemaObj.getNamespaceContext(); String[] prefixes = ctx.getDeclaredPrefixes(); for (String prefix : prefixes) { @@ -1937,12 +1911,9 @@ Element serializedSimpleType = createNewElement(doc, "simpleType", schema.schemaNamespacePrefix, XmlSchema.SCHEMA_NS); - String tmp; - tmp = simpleTypeObj.finalDerivation.getValue(); - if (!tmp.equals(Constants.BlockConstants.NONE)) { - - tmp = convertString(tmp); - serializedSimpleType.setAttribute("final", tmp); + if (simpleTypeObj.finalDerivation != null + && simpleTypeObj.finalDerivation != XmlSchemaDerivationMethod.NONE) { + serializedSimpleType.setAttribute("final", simpleTypeObj.finalDerivation.toString()); } if (simpleTypeObj.id != null) { serializedSimpleType.setAttribute("id", simpleTypeObj.id); @@ -2209,16 +2180,6 @@ return facetEl; } - // Convert given string to lower case or w3c standard - private String convertString(String convert) { - String input = convert.trim(); - if (input.equals(Constants.BlockConstants.ALL)) { - return "#all"; - } else { - return input.toLowerCase(); - } - } - // Create new element with given local name and namespaces check whether // the prefix is there or not. private Element createNewElement(Document document, String localName, String prefix, String namespace) { Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaType.java Sat Dec 20 16:32:31 2008 @@ -20,7 +20,6 @@ package org.apache.ws.commons.schema; import javax.xml.namespace.QName; -import org.apache.ws.commons.schema.constants.Constants; /** @@ -30,7 +29,6 @@ public class XmlSchemaType extends XmlSchemaAnnotated { Object baseSchemaType; - XmlSchemaDatatype dataType; XmlSchemaDerivationMethod deriveBy; XmlSchemaDerivationMethod finalDerivation; XmlSchemaDerivationMethod finalResolved; @@ -46,7 +44,7 @@ */ public XmlSchemaType(XmlSchema schema) { this.schema = schema; - finalDerivation = new XmlSchemaDerivationMethod(Constants.BlockConstants.NONE); + finalDerivation = XmlSchemaDerivationMethod.NONE; } /** @@ -69,10 +67,6 @@ return null; } - public XmlSchemaDatatype getDataType() { - return dataType; - } - public XmlSchemaDerivationMethod getDeriveBy() { return deriveBy; } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaUse.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaUse.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaUse.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaUse.java Sat Dec 20 16:32:31 2008 @@ -19,31 +19,24 @@ package org.apache.ws.commons.schema; -import org.apache.ws.commons.schema.constants.Constants; /** - * Indicator of how the attribute is used. + * use= values. */ -public class XmlSchemaUse extends org.apache.ws.commons.schema.constants.Enum { - - static String[] members = new String[] { - Constants.BlockConstants.NONE, Constants.BlockConstants.OPTIONAL, - Constants.BlockConstants.PROHIBITED, Constants.BlockConstants.REQUIRED - }; - - /** - * Creates new XmlSchemaUse - */ - public XmlSchemaUse() { - super(); +public enum XmlSchemaUse { + NONE, + OPTIONAL, + PROHIBITED, + REQUIRED; + + public static XmlSchemaUse schemaValueOf(String name) { + return EnumUtil.valueOf(XmlSchemaUse.class, name); } - public XmlSchemaUse(String value) { - super(value); + @Override + public String toString() { + return super.toString().toLowerCase(); } - public String[] getValues() { - return members; - } } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSeverityType.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSeverityType.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSeverityType.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSeverityType.java Sat Dec 20 16:32:31 2008 @@ -19,31 +19,11 @@ package org.apache.ws.commons.schema; -import org.apache.ws.commons.schema.constants.Constants; -import org.apache.ws.commons.schema.constants.Enum; - /** * Represents the severity of the validation event. */ -public class XmlSeverityType extends Enum { - - static String[] members = new String[] { - Constants.BlockConstants.ERROR, Constants.BlockConstants.WARNING - }; - - /** - * Creates new XmlSeverityType - */ - public XmlSeverityType() { - super(); - } - - public XmlSeverityType(String value) { - super(value); - } - - public String[] getValues() { - return members; - } +public enum XmlSeverityType { + ERROR, + WARNING; } Modified: webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/constants/Constants.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/constants/Constants.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/constants/Constants.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/constants/Constants.java Sat Dec 20 16:32:31 2008 @@ -27,34 +27,6 @@ public final class Constants { /** - * All constants that are relevant to the names of the schema elements - */ - public static final class BlockConstants { - public static final String ALL = "all"; - public static final String ELEMENT_ONLY = "elementOnly"; - public static final String EMPTY = "empty"; - public static final String ERROR = "error"; - public static final String EXTENSION = "extension"; - public static final String LAX = "lax"; - public static final String LIST = "list"; - public static final String MIXED = "mixed"; - public static final String NONE = "none"; - public static final String OPTIONAL = "optional"; - public static final String PROHIBITED = "prohibited"; - public static final String REQUIRED = "required"; - public static final String RESTRICTION = "restriction"; - public static final String SKIP = "skip"; - public static final String STRICT = "strict"; - public static final String SUBSITUTION = "substitution"; - public static final String TEXT_ONLY = "textOnly"; - public static final String UNION = "union"; - public static final String WARNING = "warning"; - - private BlockConstants() { - } - } - - /** * class holding the the constants for meta data storage */ public static final class MetaDataConstants { Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/BlockTest.java Sat Dec 20 16:32:31 2008 @@ -44,7 +44,7 @@ XmlSchemaElement elementByName = s.getElementByName(elementQName); assertNotNull(elementByName); - String value = elementByName.getBlock().getValue(); + String value = elementByName.getBlock().toString(); assertEquals("restriction", value); } Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentExtensionTest.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentExtensionTest.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentExtensionTest.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentExtensionTest.java Sat Dec 20 16:32:31 2008 @@ -92,20 +92,20 @@ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), xsa.getSchemaTypeName()); assertNull(xsa.getDefaultValue()); - assertEquals("required", xsa.getUse().getValue()); + assertEquals("required", xsa.getUse().toString()); assertNull(xsa.getFixedValue()); } else if ("id".equals(name)) { assertEquals(new QName("http://soapinterop.org/types", "id"), xsa.getQName()); assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"), xsa .getSchemaTypeName()); assertEquals("001", xsa.getDefaultValue()); - assertEquals("required", xsa.getUse().getValue()); + assertEquals("required", xsa.getUse().toString()); assertNull(xsa.getFixedValue()); } else if ("desc".equals(name)) { assertEquals(new QName("http://soapinterop.org/types", "desc"), xsa.getQName()); assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "decimal"), xsa .getSchemaTypeName()); - assertEquals("none", xsa.getUse().getValue()); + assertEquals("none", xsa.getUse().toString()); assertEquals("1.1", xsa.getFixedValue()); } else { fail("The name \"" + name + "\" was not expected."); Modified: webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentRestrictionTest.java URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentRestrictionTest.java?rev=728367&r1=728366&r2=728367&view=diff ============================================================================== --- webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentRestrictionTest.java (original) +++ webservices/commons/trunk/modules/XmlSchema/src/test/java/tests/SimpleContentRestrictionTest.java Sat Dec 20 16:32:31 2008 @@ -106,14 +106,14 @@ assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"), xsa.getSchemaTypeName()); assertNull(xsa.getDefaultValue()); - assertEquals("required", xsa.getUse().getValue()); + assertEquals("required", xsa.getUse().toString()); assertNull(xsa.getFixedValue()); } else if ("id".equals(name)) { assertEquals(new QName("http://soapinterop.org/types", "id"), xsa.getQName()); assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"), xsa .getSchemaTypeName()); assertEquals("001", xsa.getDefaultValue()); - assertEquals("required", xsa.getUse().getValue()); + assertEquals("required", xsa.getUse().toString()); assertNull(xsa.getFixedValue()); } else { fail("The name \"" + name + "\" was not expected.");