xssimpletypedecl.java

来自「JAVA的一些源码 JAVA2 STANDARD EDITION DEVELO」· Java 代码 · 共 1,439 行 · 第 1/5 页

JAVA
1,439
字号
/* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in *    the documentation and/or other materials provided with the *    distribution. * * 3. The end-user documentation included with the redistribution, *    if any, must include the following acknowledgment: *       "This product includes software developed by the *        Apache Software Foundation (http://www.apache.org/)." *    Alternately, this acknowledgment may appear in the software itself, *    if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xerces" and "Apache Software Foundation" must *    not be used to endorse or promote products derived from this *    software without prior written permission. For written *    permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", *    nor may "Apache" appear in their name, without prior written *    permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 2001, International * Business Machines, Inc., http://www.apache.org.  For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */package com.sun.org.apache.xerces.internal.impl.dv.xs;import java.util.StringTokenizer;import java.util.Vector;import com.sun.org.apache.xerces.internal.impl.Constants;import com.sun.org.apache.xerces.internal.impl.dv.DatatypeException;import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeFacetException;import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException;import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo;import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext;import com.sun.org.apache.xerces.internal.impl.dv.XSFacets;import com.sun.org.apache.xerces.internal.impl.dv.XSSimpleType;import com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression;import com.sun.org.apache.xerces.internal.xs.StringList;import com.sun.org.apache.xerces.internal.xs.XSAnnotation;import com.sun.org.apache.xerces.internal.xs.XSConstants;import com.sun.org.apache.xerces.internal.xs.XSFacet;import com.sun.org.apache.xerces.internal.xs.XSMultiValueFacet;import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;import com.sun.org.apache.xerces.internal.xs.XSObjectList;import com.sun.org.apache.xerces.internal.xs.XSSimpleTypeDefinition;import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;import com.sun.org.apache.xerces.internal.impl.xs.util.ShortListImpl;import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl;import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl;import com.sun.org.apache.xerces.internal.util.XMLChar;import com.sun.org.apache.xerces.internal.xni.NamespaceContext;/** * @author Sandy Gao, IBM * @author Neeraj Bajaj, Sun Microsystems, inc. * * @version $Id: XSSimpleTypeDecl.java,v 1.48 2004/01/19 15:30:20 sandygao Exp $ */public class XSSimpleTypeDecl implements XSSimpleType {    static final short DV_STRING        = PRIMITIVE_STRING;    static final short DV_BOOLEAN       = PRIMITIVE_BOOLEAN;    static final short DV_DECIMAL       = PRIMITIVE_DECIMAL;    static final short DV_FLOAT         = PRIMITIVE_FLOAT;    static final short DV_DOUBLE        = PRIMITIVE_DOUBLE;    static final short DV_DURATION      = PRIMITIVE_DURATION;    static final short DV_DATETIME      = PRIMITIVE_DATETIME;    static final short DV_TIME          = PRIMITIVE_TIME;    static final short DV_DATE          = PRIMITIVE_DATE;    static final short DV_GYEARMONTH    = PRIMITIVE_GYEARMONTH;    static final short DV_GYEAR         = PRIMITIVE_GYEAR;    static final short DV_GMONTHDAY     = PRIMITIVE_GMONTHDAY;    static final short DV_GDAY          = PRIMITIVE_GDAY;    static final short DV_GMONTH        = PRIMITIVE_GMONTH;    static final short DV_HEXBINARY     = PRIMITIVE_HEXBINARY;    static final short DV_BASE64BINARY  = PRIMITIVE_BASE64BINARY;    static final short DV_ANYURI        = PRIMITIVE_ANYURI;    static final short DV_QNAME         = PRIMITIVE_QNAME;    static final short DV_NOTATION      = PRIMITIVE_NOTATION;    static final short DV_ANYSIMPLETYPE = 0;    static final short DV_ID            = DV_NOTATION + 1;    static final short DV_IDREF         = DV_NOTATION + 2;    static final short DV_ENTITY        = DV_NOTATION + 3;    static final short DV_INTEGER       = DV_NOTATION + 4;    static final short DV_LIST          = DV_NOTATION + 5;    static final short DV_UNION         = DV_NOTATION + 6;    static final TypeValidator[] fDVs = {        new AnySimpleDV(),        new StringDV(),        new BooleanDV(),        new DecimalDV(),        new FloatDV(),        new DoubleDV(),        new DurationDV(),        new DateTimeDV(),        new TimeDV(),        new DateDV(),        new YearMonthDV(),        new YearDV(),        new MonthDayDV(),        new DayDV(),        new MonthDV(),        new HexBinaryDV(),        new Base64BinaryDV(),        new AnyURIDV(),        new QNameDV(),        new QNameDV(),   // notation use the same one as qname        new IDDV(),        new IDREFDV(),        new EntityDV(),        new IntegerDV(),        new ListDV(),        new UnionDV()    };    static final short NORMALIZE_NONE = 0;    static final short NORMALIZE_TRIM = 1;    static final short NORMALIZE_FULL = 2;    static final short[] fDVNormalizeType = {        NORMALIZE_NONE, //AnySimpleDV(),        NORMALIZE_FULL, //StringDV(),        NORMALIZE_TRIM, //BooleanDV(),        NORMALIZE_TRIM, //DecimalDV(),        NORMALIZE_TRIM, //FloatDV(),        NORMALIZE_TRIM, //DoubleDV(),        NORMALIZE_TRIM, //DurationDV(),        NORMALIZE_TRIM, //DateTimeDV(),        NORMALIZE_TRIM, //TimeDV(),        NORMALIZE_TRIM, //DateDV(),        NORMALIZE_TRIM, //YearMonthDV(),        NORMALIZE_TRIM, //YearDV(),        NORMALIZE_TRIM, //MonthDayDV(),        NORMALIZE_TRIM, //DayDV(),        NORMALIZE_TRIM, //MonthDV(),        NORMALIZE_TRIM, //HexBinaryDV(),        NORMALIZE_NONE, //Base64BinaryDV(),  // Base64 know how to deal with spaces        NORMALIZE_TRIM, //AnyURIDV(),        NORMALIZE_TRIM, //QNameDV(),        NORMALIZE_TRIM, //QNameDV(),   // notation        NORMALIZE_TRIM, //IDDV(),        NORMALIZE_TRIM, //IDREFDV(),        NORMALIZE_TRIM, //EntityDV(),        NORMALIZE_TRIM, //IntegerDV(),        NORMALIZE_FULL, //ListDV(),        NORMALIZE_NONE, //UnionDV()    };    static final short SPECIAL_PATTERN_NONE     = 0;    static final short SPECIAL_PATTERN_NMTOKEN  = 1;    static final short SPECIAL_PATTERN_NAME     = 2;    static final short SPECIAL_PATTERN_NCNAME   = 3;    static final String[] SPECIAL_PATTERN_STRING   = {        "NONE", "NMTOKEN", "Name", "NCName"    };    static final String[] WS_FACET_STRING = {        "preserve", "replace", "collapse"    };    static final String URI_SCHEMAFORSCHEMA = "http://www.w3.org/2001/XMLSchema";    static final String ANY_TYPE = "anyType";    static final ValidationContext fEmptyContext = new ValidationContext() {        public boolean needFacetChecking() {            return true;        }        public boolean needExtraChecking() {            return false;        }        public boolean needToNormalize() {            return true;        }        public boolean useNamespaces () {            return true;        }        public boolean isEntityDeclared (String name) {            return false;        }        public boolean isEntityUnparsed (String name) {            return false;        }        public boolean isIdDeclared (String name) {            return false;        }        public void addId(String name) {        }        public void addIdRef(String name) {        }        public String getSymbol (String symbol) {            return null;        }        public String getURI(String prefix) {            return null;        }    };    // this will be true if this is a static XSSimpleTypeDecl    // and hence must remain immutable (i.e., applyFacets    // may not be permitted to have any effect).    private boolean fIsImmutable = false;    private XSSimpleTypeDecl fItemType;    private XSSimpleTypeDecl[] fMemberTypes;    // The most specific built-in type kind.    private short fBuiltInKind;    private String fTypeName;    private String fTargetNamespace;    private short fFinalSet = 0;    private XSSimpleTypeDecl fBase;    private short fVariety = -1;    private short fValidationDV = -1;    private short fFacetsDefined = 0;    private short fFixedFacet = 0;    //for constraining facets    private short fWhiteSpace = 0;    private int fLength = -1;    private int fMinLength = -1;    private int fMaxLength = -1;    private int fTotalDigits = -1;    private int fFractionDigits = -1;    private Vector fPattern;    private Vector fPatternStr;    private Vector fEnumeration;    private StringList fLexicalPattern;    private StringList fLexicalEnumeration;    private Object fMaxInclusive;    private Object fMaxExclusive;    private Object fMinExclusive;    private Object fMinInclusive;        // annotations for constraining facets    public XSAnnotation lengthAnnotation;    public XSAnnotation minLengthAnnotation;    public XSAnnotation maxLengthAnnotation;    public XSAnnotation whiteSpaceAnnotation;    public XSAnnotation totalDigitsAnnotation;    public XSAnnotation fractionDigitsAnnotation;    public XSObjectListImpl patternAnnotations;    public XSObjectList enumerationAnnotations;    public XSAnnotation maxInclusiveAnnotation;    public XSAnnotation maxExclusiveAnnotation;    public XSAnnotation minInclusiveAnnotation;    public XSAnnotation minExclusiveAnnotation;        // facets as objects    private XSObjectListImpl fFacets;        // enumeration and pattern facets

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?