com.sun.org.apache.xerces.internal.xs.XSObjectList Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.xs.XSObjectList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XSDAbstractTraverser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean containsQName(XSSimpleType type) {
    if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
        short primitive = type.getPrimitiveKind();
        return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
                primitive == XSSimpleType.PRIMITIVE_NOTATION);
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
        return containsQName((XSSimpleType)type.getItemType());
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
        XSObjectList members = type.getMemberTypes();
        for (int i = 0; i < members.getLength(); i++) {
            if (containsQName((XSSimpleType)members.item(i)))
                return true;
        }
    }
    return false;
}
 
Example #2
Source File: XSDAbstractTraverser.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private boolean containsQName(XSSimpleType type) {
    if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
        short primitive = type.getPrimitiveKind();
        return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
                primitive == XSSimpleType.PRIMITIVE_NOTATION);
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
        return containsQName((XSSimpleType)type.getItemType());
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
        XSObjectList members = type.getMemberTypes();
        for (int i = 0; i < members.getLength(); i++) {
            if (containsQName((XSSimpleType)members.item(i)))
                return true;
        }
    }
    return false;
}
 
Example #3
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected XSSimpleTypeDecl setListValues(String name, String uri, short finalSet, XSSimpleTypeDecl itemType,
        XSObjectList annotations) {
    //decline to do anything if the object is immutable.
    if(fIsImmutable) return null;
    fBase = fAnySimpleType;
    fAnonymous = false;
    fTypeName = name;
    fTargetNamespace = uri;
    fFinalSet = finalSet;
    fAnnotations = annotations;

    fVariety = VARIETY_LIST;
    fItemType = (XSSimpleTypeDecl)itemType;
    fValidationDV = DV_LIST;
    fFacetsDefined = FACET_WHITESPACE;
    fFixedFacet = FACET_WHITESPACE;
    fWhiteSpace = WS_COLLAPSE;

    //setting fundamental facets
    calcFundamentalFacets();

    // Values of this type are lists
    fBuiltInKind = XSConstants.LIST_DT;

    return this;
}
 
Example #4
Source File: XSSimpleTypeDecl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks if a type is derived from another by union.  See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by union for the reference type
 */
private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) {

    // If the variety is union
    if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) {

        // get member types
        XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes();

        for (int i = 0; i < memberTypes.getLength(); i++) {
            // One of the {member type definitions} is T2.
            if (memberTypes.item(i) != null) {
                // T2 is derived from the other type definition by DERIVATION_RESTRICTION
                if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #5
Source File: XSDAbstractTraverser.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private boolean containsQName(XSSimpleType type) {
    if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
        short primitive = type.getPrimitiveKind();
        return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
                primitive == XSSimpleType.PRIMITIVE_NOTATION);
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
        return containsQName((XSSimpleType)type.getItemType());
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
        XSObjectList members = type.getMemberTypes();
        for (int i = 0; i < members.getLength(); i++) {
            if (containsQName((XSSimpleType)members.item(i)))
                return true;
        }
    }
    return false;
}
 
Example #6
Source File: XSSimpleTypeDecl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks if a type is derived from another by union.  See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by union for the reference type
 */
private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) {

    // If the variety is union
    if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) {

        // get member types
        XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes();

        for (int i = 0; i < memberTypes.getLength(); i++) {
            // One of the {member type definitions} is T2.
            if (memberTypes.item(i) != null) {
                // T2 is derived from the other type definition by DERIVATION_RESTRICTION
                if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #7
Source File: XSDAbstractTraverser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private boolean containsQName(XSSimpleType type) {
    if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
        short primitive = type.getPrimitiveKind();
        return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
                primitive == XSSimpleType.PRIMITIVE_NOTATION);
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
        return containsQName((XSSimpleType)type.getItemType());
    }
    else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
        XSObjectList members = type.getMemberTypes();
        for (int i = 0; i < members.getLength(); i++) {
            if (containsQName((XSSimpleType)members.item(i)))
                return true;
        }
    }
    return false;
}
 
Example #8
Source File: XSSimpleTypeDecl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
protected XSSimpleTypeDecl setListValues(String name, String uri, short finalSet, XSSimpleTypeDecl itemType,
        XSObjectList annotations) {
    //decline to do anything if the object is immutable.
    if(fIsImmutable) return null;
    fBase = fAnySimpleType;
    fAnonymous = false;
    fTypeName = name;
    fTargetNamespace = uri;
    fFinalSet = finalSet;
    fAnnotations = annotations;

    fVariety = VARIETY_LIST;
    fItemType = (XSSimpleTypeDecl)itemType;
    fValidationDV = DV_LIST;
    fFacetsDefined = FACET_WHITESPACE;
    fFixedFacet = FACET_WHITESPACE;
    fWhiteSpace = WS_COLLAPSE;

    //setting fundamental facets
    calcFundamentalFacets();

    // Values of this type are lists
    fBuiltInKind = XSConstants.LIST_DT;

    return this;
}
 
Example #9
Source File: XSSimpleTypeDecl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks if a type is derived from another by union.  See:
 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
 *
 * @param ancestorNS
 *            The namspace of the ancestor type declaration
 * @param ancestorName
 *            The name of the ancestor type declaration
 * @param type
 *            The reference type definition
 *
 * @return boolean True if the type is derived by union for the reference type
 */
private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) {

    // If the variety is union
    if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) {

        // get member types
        XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes();

        for (int i = 0; i < memberTypes.getLength(); i++) {
            // One of the {member type definitions} is T2.
            if (memberTypes.item(i) != null) {
                // T2 is derived from the other type definition by DERIVATION_RESTRICTION
                if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #10
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void expandRelatedAttributeUsesComponents(XSObjectList attrUses, Vector componentList,
        String namespace, Map<String, Vector> dependencies) {
    final int attrUseSize = (attrUses == null) ? 0 : attrUses.size();
    for (int i=0; i<attrUseSize; i++) {
        expandRelatedAttributeUseComponents((XSAttributeUse)attrUses.item(i), componentList, namespace, dependencies);
    }
}
 
Example #11
Source File: SchemaGrammar.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see org.apache.xerces.xs.XSNamespaceItem#getAnnotations()
 */
public XSObjectList getAnnotations() {
    if (fNumAnnotations == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }
    return new XSObjectListImpl(fAnnotations, fNumAnnotations);
}
 
Example #12
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void expandRelatedModelGroupComponents(XSModelGroup modelGroup, Vector componentList,
        String namespace, Map<String, Vector> dependencies) {
    XSObjectList particles = modelGroup.getParticles();
    final int length = (particles == null) ? 0 : particles.getLength();
    for (int i=0; i<length; i++) {
        expandRelatedParticleComponents((XSParticle)particles.item(i), componentList, namespace, dependencies);
    }
}
 
Example #13
Source File: XSAttributeDecl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}
 
Example #14
Source File: SchemaGrammar.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see org.apache.xerces.xs.XSNamespaceItem#getAnnotations()
 */
public XSObjectList getAnnotations() {
    if (fNumAnnotations == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }
    return new XSObjectListImpl(fAnnotations, fNumAnnotations);
}
 
Example #15
Source File: XSAttributeDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void setValues(String name, String targetNamespace,
        XSSimpleType simpleType, short constraintType, short scope,
        ValidatedInfo valInfo, XSComplexTypeDecl enclosingCT,
        XSObjectList annotations) {
    fName = name;
    fTargetNamespace = targetNamespace;
    fType = simpleType;
    fConstraintType = constraintType;
    fScope = scope;
    fDefault = valInfo;
    fEnclosingCT = enclosingCT;
    fAnnotations = annotations;
}
 
Example #16
Source File: XSDSimpleTypeTraverser.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private boolean isListDatatype(XSSimpleType validator) {
    if (validator.getVariety() == XSSimpleType.VARIETY_LIST)
        return true;

    if (validator.getVariety() == XSSimpleType.VARIETY_UNION) {
        XSObjectList temp = validator.getMemberTypes();
        for (int i = 0; i < temp.getLength(); i++) {
            if (((XSSimpleType)temp.item(i)).getVariety() == XSSimpleType.VARIETY_LIST) {
                return true;
            }
        }
    }

    return false;
}
 
Example #17
Source File: BaseSchemaDVFactory.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Create a new simple type which is derived by union from a list of other
 * simple types.
 *
 * @param name              name of the new type, could be null
 * @param targetNamespace   target namespace of the new type, could be null
 * @param finalSet          value of "final"
 * @param memberTypes       member types of the union type
 * @param annotations       set of annotations
 * @return                  the newly created simple type
 */
public XSSimpleType createTypeUnion(String name, String targetNamespace,
                                    short finalSet, XSSimpleType[] memberTypes,
                                    XSObjectList annotations) {
    int typeNum = memberTypes.length;
    XSSimpleTypeDecl[] mtypes = new XSSimpleTypeDecl[typeNum];
    System.arraycopy(memberTypes, 0, mtypes, 0, typeNum);

    if (fDeclPool != null) {
       XSSimpleTypeDecl st= fDeclPool.getSimpleTypeDecl();
       return st.setUnionValues(name, targetNamespace, finalSet, mtypes, annotations);
    }
    return new XSSimpleTypeDecl(name, targetNamespace, finalSet, mtypes, annotations);
}
 
Example #18
Source File: XSSimpleTypeDecl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected XSSimpleTypeDecl setUnionValues(String name, String uri, short finalSet, XSSimpleTypeDecl[] memberTypes,
        XSObjectList annotations) {
    //decline to do anything if the object is immutable.
    if(fIsImmutable) return null;
    fBase = fAnySimpleType;
    fAnonymous = false;
    fTypeName = name;
    fTargetNamespace = uri;
    fFinalSet = finalSet;
    fAnnotations = annotations;

    fVariety = VARIETY_UNION;
    fMemberTypes = memberTypes;
    fValidationDV = DV_UNION;
    // even for union, we set whitespace to something
    // this will never be used, but we can use fFacetsDefined to check
    // whether applyFacets() is allwwed: it's not allowed
    // if fFacetsDefined != 0
    fFacetsDefined = FACET_WHITESPACE;
    fWhiteSpace = WS_COLLAPSE;

    //setting fundamental facets
    calcFundamentalFacets();

    // No value can be of this type, so it's unavailable.
    fBuiltInKind = XSConstants.UNAVAILABLE_DT;

    return this;
}
 
Example #19
Source File: SchemaGrammar.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see org.apache.xerces.xs.XSNamespaceItem#getAnnotations()
 */
public XSObjectList getAnnotations() {
    if (fNumAnnotations == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }
    return new XSObjectListImpl(fAnnotations, fNumAnnotations);
}
 
Example #20
Source File: SchemaGrammar.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see org.apache.xerces.xs.XSNamespaceItem#getAnnotations()
 */
public XSObjectList getAnnotations() {
    if (fNumAnnotations == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }
    return new XSObjectListImpl(fAnnotations, fNumAnnotations);
}
 
Example #21
Source File: XSSimpleTypeDecl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected XSSimpleTypeDecl(String name, String uri, short finalSet, XSSimpleTypeDecl[] memberTypes,
        XSObjectList annotations) {
    fBase = fAnySimpleType;
    fTypeName = name;
    fTargetNamespace = uri;
    fFinalSet = finalSet;
    fAnnotations = annotations;

    fVariety = VARIETY_UNION;
    fMemberTypes = memberTypes;
    fValidationDV = DV_UNION;
    // even for union, we set whitespace to something
    // this will never be used, but we can use fFacetsDefined to check
    // whether applyFacets() is allwwed: it's not allowed
    // if fFacetsDefined != 0
    fFacetsDefined = FACET_WHITESPACE;
    fWhiteSpace = WS_COLLAPSE;

    //setting fundamental facets
    calcFundamentalFacets();
    // none of the schema-defined types are unions, so just set
    // fIsImmutable to false.
    fIsImmutable = false;

    // No value can be of this type, so it's unavailable.
    fBuiltInKind = XSConstants.UNAVAILABLE_DT;
}
 
Example #22
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void expandRelatedModelGroupComponents(XSModelGroup modelGroup, Vector componentList,
        String namespace, Map<String, Vector> dependencies) {
    XSObjectList particles = modelGroup.getParticles();
    final int length = (particles == null) ? 0 : particles.getLength();
    for (int i=0; i<length; i++) {
        expandRelatedParticleComponents((XSParticle)particles.item(i), componentList, namespace, dependencies);
    }
}
 
Example #23
Source File: XSNotationDecl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Optional. Annotations.
 */
public XSObjectList getAnnotations() {
    return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}
 
Example #24
Source File: XSSimpleTypeDelegate.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public XSObjectList getMultiValueFacets() {
    return type.getMultiValueFacets();
}
 
Example #25
Source File: XSModelGroupImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {particles} A list of particles
 */
public XSObjectList getParticles() {
    return new XSObjectListImpl(fParticles, fParticleCount);
}
 
Example #26
Source File: XSAttributeGroupDecl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Optional. Annotations.
 */
public XSObjectList getAnnotations() {
    return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}
 
Example #27
Source File: XSModelGroupImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {particles} A list of particles
 */
public XSObjectList getParticles() {
    return new XSObjectListImpl(fParticles, fParticleCount);
}
 
Example #28
Source File: XSSimpleTypeDecl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Optional. Annotations.
 */
public XSObjectList getAnnotations() {
    return annotations;
}
 
Example #29
Source File: XSAttributeDecl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Optional. Annotations.
 */
public XSObjectList getAnnotations() {
    return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}
 
Example #30
Source File: XSModelGroupImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Optional. Annotations.
 */
public XSObjectList getAnnotations() {
    return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
}