org.w3c.dom.TypeInfo#com.sun.org.apache.xerces.internal.xs.XSTypeDefinition源码实例Demo

下面列出了org.w3c.dom.TypeInfo#com.sun.org.apache.xerces.internal.xs.XSTypeDefinition 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u60   文件: DOMResultAugmentor.java
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    final Node currentElement = fDOMValidatorHelper.getCurrentElement();
    // Write type information to this element
    if (augs != null && fDocumentImpl != null) {
        ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            if (fStorePSVI) {
                ((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI);
            }
            XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
            if (type == null) {
                type = elementPSVI.getTypeDefinition();
            }
            ((ElementNSImpl) currentElement).setType(type);
        }
    }
}
 
源代码2 项目: hottub   文件: XSSimpleTypeDecl.java
/**
 * DOM Level 3
 * Checks if a type is derived from another by restriction. 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 restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
                        || (type.getNamespace() == null && ancestorNS == null))) {

            return true;
        }
        oldType = type;
        type = type.getBaseType();
    }

    return false;
}
 
源代码3 项目: jdk1.8-source-analysis   文件: XSSimpleTypeDecl.java
/**
 * DOM Level 3
 * Checks if a type is derived from another by restriction. 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 restriciton for the
 *         reference type
 */
private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    XSTypeDefinition oldType = null;
    while (type != null && type != oldType) {
        if ((ancestorName.equals(type.getName()))
                && ((ancestorNS != null && ancestorNS.equals(type.getNamespace()))
                        || (type.getNamespace() == null && ancestorNS == null))) {

            return true;
        }
        oldType = type;
        type = type.getBaseType();
    }

    return false;
}
 
源代码4 项目: jdk1.8-source-analysis   文件: XSSimpleTypeDecl.java
/**
 * Checks if a type is derived from another by list. 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 list for the reference type
 */
private boolean isDerivedByList (String ancestorNS, String ancestorName, XSTypeDefinition type) {
    // If the variety is union
    if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_LIST) {

        // get the {item type}
        XSTypeDefinition itemType = ((XSSimpleTypeDefinition)type).getItemType();

        // T2 is the {item type definition}
        if (itemType != null) {

            // T2 is derived from the other type definition by DERIVATION_RESTRICTION
            if (isDerivedByRestriction(ancestorNS, ancestorName, itemType)) {
                return true;
            }
        }
    }
    return false;
}
 
源代码5 项目: openjdk-8   文件: XSConstraints.java
/**
 * check whether simple type derived is valid derived from base,
 * given a subset of {restriction, extension}.
 */
public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
    // if derived is anySimpleType, then it's valid only if the base
    // is ur-type
    if (derived == SchemaGrammar.fAnySimpleType) {
        return (base == SchemaGrammar.fAnyType ||
                base == SchemaGrammar.fAnySimpleType);
    }

    // if base is complex type
    if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
        // if base is anyType, change base to anySimpleType,
        // otherwise, not valid
        if (base == SchemaGrammar.fAnyType)
            base = SchemaGrammar.fAnySimpleType;
        else
            return false;
    }
    return checkSimpleDerivation((XSSimpleType)derived,
            (XSSimpleType)base, block);
}
 
private boolean getDBMethods(XSTypeDefinition typed, XSTypeDefinition typeb,
                             OneSubGroup methods) {
    short dMethod = 0, bMethod = 0;
    while (typed != typeb && typed != SchemaGrammar.fAnyType) {
        if (typed.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
            dMethod |= ((XSComplexTypeDecl)typed).fDerivedBy;
        else
            dMethod |= XSConstants.DERIVATION_RESTRICTION;
        typed = typed.getBaseType();
        // type == null means the current type is anySimpleType,
        // whose base type should be anyType
        if (typed == null)
            typed = SchemaGrammar.fAnyType;
        if (typed.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
            bMethod |= ((XSComplexTypeDecl)typed).fBlock;
    }
    // No derivation relation, or blocked, return false
    if (typed != typeb || (dMethod & bMethod) != 0)
        return false;

    // Remember the derivation methods and blocks, return true.
    methods.dMethod = dMethod;
    methods.bMethod = bMethod;
    return true;
}
 
源代码7 项目: openjdk-jdk8u   文件: XSConstraints.java
/**
 * check whether simple type derived is valid derived from base,
 * given a subset of {restriction, extension}.
 */
public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
    // if derived is anySimpleType, then it's valid only if the base
    // is ur-type
    if (derived == SchemaGrammar.fAnySimpleType) {
        return (base == SchemaGrammar.fAnyType ||
                base == SchemaGrammar.fAnySimpleType);
    }

    // if base is complex type
    if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
        // if base is anyType, change base to anySimpleType,
        // otherwise, not valid
        if (base == SchemaGrammar.fAnyType)
            base = SchemaGrammar.fAnySimpleType;
        else
            return false;
    }
    return checkSimpleDerivation((XSSimpleType)derived,
            (XSSimpleType)base, block);
}
 
源代码8 项目: JDKSourceCode1.8   文件: DOMResultAugmentor.java
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    final Node currentElement = fDOMValidatorHelper.getCurrentElement();
    // Write type information to this element
    if (augs != null && fDocumentImpl != null) {
        ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            if (fStorePSVI) {
                ((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI);
            }
            XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
            if (type == null) {
                type = elementPSVI.getTypeDefinition();
            }
            ((ElementNSImpl) currentElement).setType(type);
        }
    }
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: XSConstraints.java
/**
 * check whether simple type derived is valid derived from base,
 * given a subset of {restriction, extension}.
 */
public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
    // if derived is anySimpleType, then it's valid only if the base
    // is ur-type
    if (derived == SchemaGrammar.fAnySimpleType) {
        return (base == SchemaGrammar.fAnyType ||
                base == SchemaGrammar.fAnySimpleType);
    }

    // if base is complex type
    if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
        // if base is anyType, change base to anySimpleType,
        // otherwise, not valid
        if (base == SchemaGrammar.fAnyType)
            base = SchemaGrammar.fAnySimpleType;
        else
            return false;
    }
    return checkSimpleDerivation((XSSimpleType)derived,
            (XSSimpleType)base, block);
}
 
源代码10 项目: JDKSourceCode1.8   文件: XSDHandler.java
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
源代码11 项目: Bytecoder   文件: XSConstraints.java
/**
 * check whether simple type derived is valid derived from base,
 * given a subset of {restriction, extension}.
 */
public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) {
    // if derived is anySimpleType, then it's valid only if the base
    // is ur-type
    if (derived == SchemaGrammar.fAnySimpleType) {
        return (base == SchemaGrammar.fAnyType ||
                base == SchemaGrammar.fAnySimpleType);
    }

    // if base is complex type
    if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
        // if base is anyType, change base to anySimpleType,
        // otherwise, not valid
        if (base == SchemaGrammar.fAnyType)
            base = SchemaGrammar.fAnySimpleType;
        else
            return false;
    }
    return checkSimpleDerivation(derived, (XSSimpleType)base, block);
}
 
源代码12 项目: openjdk-jdk8u   文件: DOMResultBuilder.java
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    // write type information to this element
    if (augs != null && fDocumentImpl != null) {
        ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            if (fStorePSVI) {
                ((PSVIElementNSImpl)fCurrentNode).setPSVI(elementPSVI);
            }
            XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
            if (type == null) {
                type = elementPSVI.getTypeDefinition();
            }
            ((ElementNSImpl)fCurrentNode).setType(type);
        }
    }

    // adjust current node reference
    if (fCurrentNode == fFragmentRoot) {
        fCurrentNode = null;
        fFragmentRoot = null;
        return;
    }
    fCurrentNode = fCurrentNode.getParentNode();
}
 
源代码13 项目: hottub   文件: XSSimpleTypeDecl.java
/**
 * 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;
}
 
源代码14 项目: TencentKona-8   文件: DOMResultAugmentor.java
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    final Node currentElement = fDOMValidatorHelper.getCurrentElement();
    // Write type information to this element
    if (augs != null && fDocumentImpl != null) {
        ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        if (elementPSVI != null) {
            if (fStorePSVI) {
                ((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI);
            }
            XSTypeDefinition type = elementPSVI.getMemberTypeDefinition();
            if (type == null) {
                type = elementPSVI.getTypeDefinition();
            }
            ((ElementNSImpl) currentElement).setType(type);
        }
    }
}
 
源代码15 项目: TencentKona-8   文件: XSSimpleTypeDecl.java
/**
 * 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;
}
 
源代码16 项目: jdk8u60   文件: XSDHandler.java
private void expandRelatedSimpleTypeComponents(XSSimpleTypeDefinition type, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    final XSTypeDefinition baseType = type.getBaseType();
    if (baseType != null) {
        addRelatedType(baseType, componentList, namespace, dependencies);
    }

    final XSTypeDefinition itemType = type.getItemType();
    if (itemType != null) {
        addRelatedType(itemType, componentList, namespace, dependencies);
    }

    final XSTypeDefinition primitiveType = type.getPrimitiveType();
    if (primitiveType != null) {
        addRelatedType(primitiveType, componentList, namespace, dependencies);
    }

    final XSObjectList memberTypes = type.getMemberTypes();
    if (memberTypes.size() > 0) {
        for (int i=0; i<memberTypes.size(); i++) {
            addRelatedType((XSTypeDefinition)memberTypes.item(i), componentList, namespace, dependencies);
        }
    }
}
 
源代码17 项目: hottub   文件: XSDHandler.java
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
源代码18 项目: openjdk-8-source   文件: SchemaGrammar.java
/**
 * register one global type
 */
public void addGlobalTypeDecl(XSTypeDefinition decl) {
    fGlobalTypeDecls.put(decl.getName(), decl);
    if (decl instanceof XSComplexTypeDecl) {
        ((XSComplexTypeDecl) decl).setNamespaceItem(this);
    }
    else if (decl instanceof XSSimpleTypeDecl) {
        ((XSSimpleTypeDecl) decl).setNamespaceItem(this);
    }
}
 
源代码19 项目: openjdk-jdk8u   文件: XSDAbstractTraverser.java
/**
 * Element/Attribute traversers call this method to check whether
 * the type is NOTATION without enumeration facet
 */
void checkNotationType(String refName, XSTypeDefinition typeDecl, Element elem) {
    if (typeDecl.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE &&
            ((XSSimpleType)typeDecl).getVariety() == XSSimpleType.VARIETY_ATOMIC &&
            ((XSSimpleType)typeDecl).getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) {
        if ((((XSSimpleType)typeDecl).getDefinedFacets() & XSSimpleType.FACET_ENUMERATION) == 0) {
            reportSchemaError("enumeration-required-notation", new Object[]{typeDecl.getName(), refName, DOMUtil.getLocalName(elem)}, elem);
        }
    }
}
 
源代码20 项目: TencentKona-8   文件: SchemaGrammar.java
/**
 * register one global type
 */
public void addGlobalTypeDecl(XSTypeDefinition decl) {
    fGlobalTypeDecls.put(decl.getName(), decl);
    if (decl instanceof XSComplexTypeDecl) {
        ((XSComplexTypeDecl) decl).setNamespaceItem(this);
    }
    else if (decl instanceof XSSimpleTypeDecl) {
        ((XSSimpleTypeDecl) decl).setNamespaceItem(this);
    }
}
 
源代码21 项目: openjdk-jdk9   文件: XMLSchemaValidator.java
public boolean characterData(String data, Augmentations augs) {

        fSawText = fSawText || data.length() > 0;

        // REVISIT: this methods basically duplicates implementation of
        //          handleCharacters(). We should be able to reuse some code

        // if whitespace == -1 skip normalization, because it is a complexType
        // or a union type.
        if (fNormalizeData && fWhiteSpace != -1 && fWhiteSpace != XSSimpleType.WS_PRESERVE) {
            // normalize data
            normalizeWhitespace(data, fWhiteSpace == XSSimpleType.WS_COLLAPSE);
            fBuffer.append(fNormalizedStr.ch, fNormalizedStr.offset, fNormalizedStr.length);
        } else {
            if (fAppendBuffer)
                fBuffer.append(data);
        }

        // When it's a complex type with element-only content, we need to
        // find out whether the content contains any non-whitespace character.
        boolean allWhiteSpace = true;
        if (fCurrentType != null
            && fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
            XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
            if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) {
                // data outside of element content
                for (int i = 0; i < data.length(); i++) {
                    if (!XMLChar.isSpace(data.charAt(i))) {
                        allWhiteSpace = false;
                        fSawCharacters = true;
                        break;
                    }
                }
            }
        }

        return allWhiteSpace;
    }
 
源代码22 项目: openjdk-jdk8u-backup   文件: XSNamedMap4Types.java
/**
 * Retrieves an <code>XSObject</code> specified by local name and namespace
 * URI.
 * @param namespace The namespace URI of the <code>XSObject</code> to
 *   retrieve.
 * @param localName The local name of the <code>XSObject</code> to retrieve.
 * @return A <code>XSObject</code> (of any type) with the specified local
 *   name and namespace URI, or <code>null</code> if they do not
 *   identify any <code>XSObject</code> in this map.
 */
public XSObject itemByName(String namespace, String localName) {
    for (int i = 0; i < fNSNum; i++) {
        if (isEqual(namespace, fNamespaces[i])) {
            XSTypeDefinition type = (XSTypeDefinition)fMaps[i].get(localName);
            // only return it if it matches the required type
            if (type != null && type.getTypeCategory() == fType) {
                return type;
            }
            return null;
        }
    }
    return null;
}
 
源代码23 项目: JDKSourceCode1.8   文件: XMLSchemaValidator.java
Object elementLocallyValidType(QName element, Object textContent) {
    if (fCurrentType == null)
        return null;

    Object retValue = null;
    // Element Locally Valid (Type)
    // 3 The appropriate case among the following must be true:
    // 3.1 If the type definition is a simple type definition, then all of the following must be true:
    if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // 3.1.2 The element information item must have no element information item [children].
        if (fSubElement)
            reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname });
        // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4).
        if (!fNil) {
            XSSimpleType dv = (XSSimpleType) fCurrentType;
            try {
                if (!fNormalizeData || fUnionType) {
                    fValidationState.setNormalizationRequired(true);
                }
                retValue = dv.validate(textContent, fValidationState, fValidatedInfo);
            } catch (InvalidDatatypeValueException e) {
                reportSchemaError(e.getKey(), e.getArgs());
                reportSchemaError(
                    "cvc-type.3.1.3",
                    new Object[] { element.rawname, textContent });
            }
        }
    } else {
        // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4);
        retValue = elementLocallyValidComplexType(element, textContent);
    }

    return retValue;
}
 
源代码24 项目: JDKSourceCode1.8   文件: XSConstraints.java
/**
 * check whether complex type derived is valid derived from base,
 * given a subset of {restriction, extension}.
 */
public static boolean checkComplexDerivationOk(XSComplexTypeDecl derived, XSTypeDefinition base, short block) {
    // if derived is anyType, then it's valid only if base is anyType too
    if (derived == SchemaGrammar.fAnyType)
        return derived == base;
    return checkComplexDerivation((XSComplexTypeDecl)derived, base, block);
}
 
源代码25 项目: JDKSourceCode1.8   文件: XSNamedMap4Types.java
/**
 * Retrieves an <code>XSObject</code> specified by local name and namespace
 * URI.
 * @param namespace The namespace URI of the <code>XSObject</code> to
 *   retrieve.
 * @param localName The local name of the <code>XSObject</code> to retrieve.
 * @return A <code>XSObject</code> (of any type) with the specified local
 *   name and namespace URI, or <code>null</code> if they do not
 *   identify any <code>XSObject</code> in this map.
 */
public XSObject itemByName(String namespace, String localName) {
    for (int i = 0; i < fNSNum; i++) {
        if (isEqual(namespace, fNamespaces[i])) {
            XSTypeDefinition type = (XSTypeDefinition)fMaps[i].get(localName);
            // only return it if it matches the required type
            if (type != null && type.getTypeCategory() == fType) {
                return type;
            }
            return null;
        }
    }
    return null;
}
 
源代码26 项目: hottub   文件: SchemaGrammar.java
public void setValues(String name, String targetNamespace,
        XSTypeDefinition baseType, short derivedBy, short schemaFinal,
        short block, short contentType,
        boolean isAbstract, XSAttributeGroupDecl attrGrp,
        XSSimpleType simpleType, XSParticleDecl particle) {
    // don't allow this.
}
 
源代码27 项目: jdk8u60   文件: XSModelImpl.java
/**
 * Convenience method. Returns a top-level simple or complex type
 * definition.
 * @param name The name of the definition.
 * @param namespace The namespace of the definition, otherwise null.
 * @param loc The schema location where the component was defined
 * @return An <code>XSTypeDefinition</code> or null if such definition
 *   does not exist.
 */
public XSTypeDefinition getTypeDefinition(String name,
                                          String namespace,
                                          String loc) {
    SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
    if (sg == null) {
        return null;
    }
    return sg.getGlobalTypeDecl(name, loc);
}
 
源代码28 项目: Bytecoder   文件: XSDAbstractTraverser.java
public static String getSchemaTypeName(XSTypeDefinition typeDefn) {

        String typeNameStr = "";
        if (typeDefn instanceof XSSimpleTypeDefinition) {
            typeNameStr = ((XSSimpleTypeDecl) typeDefn).getTypeName();
        }
        else {
            typeNameStr = ((XSComplexTypeDecl) typeDefn).getTypeName();
        }

        return typeNameStr;

    }
 
源代码29 项目: jdk1.8-source-analysis   文件: XSConstraints.java
/**
 * check whether derived is valid derived from base, given a subset
 * of {restriction, extension}.B
 */
public static boolean checkTypeDerivationOk(XSTypeDefinition derived, XSTypeDefinition base, short block) {
    // if derived is anyType, then it's valid only if base is anyType too
    if (derived == SchemaGrammar.fAnyType)
        return derived == base;
    // if derived is anySimpleType, then it's valid only if the base
    // is ur-type
    if (derived == SchemaGrammar.fAnySimpleType) {
        return (base == SchemaGrammar.fAnyType ||
                base == SchemaGrammar.fAnySimpleType);
    }

    // if derived is simple type
    if (derived.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
        // if base is complex type
        if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
            // if base is anyType, change base to anySimpleType,
            // otherwise, not valid
            if (base == SchemaGrammar.fAnyType)
                base = SchemaGrammar.fAnySimpleType;
            else
                return false;
        }
        return checkSimpleDerivation((XSSimpleType)derived,
                (XSSimpleType)base, block);
    }
    else {
        return checkComplexDerivation((XSComplexTypeDecl)derived, base, block);
    }
}
 
源代码30 项目: openjdk-jdk8u   文件: SchemaGrammar.java
/**
 * register one global type
 */
public void addGlobalTypeDecl(XSTypeDefinition decl) {
    fGlobalTypeDecls.put(decl.getName(), decl);
    if (decl instanceof XSComplexTypeDecl) {
        ((XSComplexTypeDecl) decl).setNamespaceItem(this);
    }
    else if (decl instanceof XSSimpleTypeDecl) {
        ((XSSimpleTypeDecl) decl).setNamespaceItem(this);
    }
}