5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk/*
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * This code is free software; you can redistribute it and/or modify it
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * under the terms of the GNU General Public License version 2 only, as
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * published by the Free Software Foundation. Oracle designates this
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * particular file as subject to the "Classpath" exception as provided
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * by Oracle in the LICENSE file that accompanied this code.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * This code is distributed in the hope that it will be useful, but WITHOUT
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * version 2 for more details (a copy is included in the LICENSE file that
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * accompanied this code).
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * You should have received a copy of the GNU General Public License version
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * 2 along with this work; if not, write to the Free Software Foundation,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * or visit www.oracle.com if you need additional information or have any
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * questions.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk/*
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * Copyright 2005 The Apache Software Foundation.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkpackage com.sun.xml.internal.stream.dtd.nonvalidating;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk/**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenkpublic class XMLSimpleType {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk //
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // Constants
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk //
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** TYPE_CDATA */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short TYPE_CDATA = 0;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** TYPE_ENTITY */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short TYPE_ENTITY = 1;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** TYPE_ENUMERATION */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short TYPE_ENUMERATION = 2;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** TYPE_ID */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short TYPE_ID = 3;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** TYPE_IDREF */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short TYPE_IDREF = 4;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** TYPE_NMTOKEN */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short TYPE_NMTOKEN = 5;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** TYPE_NOTATION */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short TYPE_NOTATION = 6;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** TYPE_NAMED */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short TYPE_NAMED = 7;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** DEFAULT_TYPE_DEFAULT */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short DEFAULT_TYPE_DEFAULT = 3;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** DEFAULT_TYPE_FIXED */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short DEFAULT_TYPE_FIXED = 1;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** DEFAULT_TYPE_IMPLIED */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short DEFAULT_TYPE_IMPLIED = 0;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** DEFAULT_TYPE_REQUIRED */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public static final short DEFAULT_TYPE_REQUIRED = 2;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk //
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // Data
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk //
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** type */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public short type;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** name */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public String name;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** enumeration */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public String[] enumeration;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** list */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public boolean list;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** defaultType */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public short defaultType;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** defaultValue */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public String defaultValue;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** non-normalized defaultValue */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public String nonNormalizedDefaultValue;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk //
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // Methods
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk //
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * setValues
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk *
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param type
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param name
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param enumeration
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param list
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param defaultType
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param defaultValue
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param nonNormalizedDefaultValue
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * @param datatypeValidator
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void setValues(short type, String name, String[] enumeration,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk boolean list, short defaultType,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk String defaultValue, String nonNormalizedDefaultValue){
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.type = type;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.name = name;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // REVISIT: Should this be a copy? -Ac
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if (enumeration != null && enumeration.length > 0) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.enumeration = new String[enumeration.length];
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk System.arraycopy(enumeration, 0, this.enumeration, 0, this.enumeration.length);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk else {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.enumeration = null;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.list = list;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.defaultType = defaultType;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.defaultValue = defaultValue;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.nonNormalizedDefaultValue = nonNormalizedDefaultValue;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } // setValues(short,String,String[],boolean,short,String,String,DatatypeValidator)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /** Set values. */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void setValues(XMLSimpleType simpleType) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk type = simpleType.type;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk name = simpleType.name;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk // REVISIT: Should this be a copy? -Ac
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if (simpleType.enumeration != null && simpleType.enumeration.length > 0) {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk enumeration = new String[simpleType.enumeration.length];
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk System.arraycopy(simpleType.enumeration, 0, enumeration, 0, enumeration.length);
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk else {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk enumeration = null;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk list = simpleType.list;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk defaultType = simpleType.defaultType;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk defaultValue = simpleType.defaultValue;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk nonNormalizedDefaultValue = simpleType.nonNormalizedDefaultValue;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk } // setValues(XMLSimpleType)
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk /**
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk * clear
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk */
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk public void clear() {
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.type = -1;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.name = null;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.enumeration = null;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.list = false;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.defaultType = -1;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.defaultValue = null;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this.nonNormalizedDefaultValue = null;
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk }
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk} // class XMLSimpleType
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk