com.sun.org.apache.xerces.internal.impl.xs.XSComplexTypeDecl

Here are the examples of the java api class com.sun.org.apache.xerces.internal.impl.xs.XSComplexTypeDecl taken from open source projects.

1. XSDComplexTypeTraverser#traverseLocal()

Project: openjdk
File: XSDComplexTypeTraverser.java
/**
     * Traverse local complexType declarations
     *
     * @param Element
     * @param XSDocumentInfo
     * @param SchemaGrammar
     * @return XSComplexTypeDecl
     */
XSComplexTypeDecl traverseLocal(Element complexTypeNode, XSDocumentInfo schemaDoc, SchemaGrammar grammar) {
    Object[] attrValues = fAttrChecker.checkAttributes(complexTypeNode, false, schemaDoc);
    String complexTypeName = genAnonTypeName(complexTypeNode);
    contentBackup();
    XSComplexTypeDecl type = traverseComplexTypeDecl(complexTypeNode, complexTypeName, attrValues, schemaDoc, grammar);
    contentRestore();
    // need to add the type to the grammar for later constraint checking
    grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode));
    type.setIsAnonymous();
    fAttrChecker.returnAttrArray(attrValues, schemaDoc);
    return type;
}

2. XSDComplexTypeTraverser#traverseComplexTypeDecl()

Project: openjdk
File: XSDComplexTypeTraverser.java
private XSComplexTypeDecl traverseComplexTypeDecl(Element complexTypeDecl, String complexTypeName, Object[] attrValues, XSDocumentInfo schemaDoc, SchemaGrammar grammar) {
    fComplexTypeDecl = new XSComplexTypeDecl();
    fAttrGrp = new XSAttributeGroupDecl();
    Boolean abstractAtt = (Boolean) attrValues[XSAttributeChecker.ATTIDX_ABSTRACT];
    XInt blockAtt = (XInt) attrValues[XSAttributeChecker.ATTIDX_BLOCK];
    Boolean mixedAtt = (Boolean) attrValues[XSAttributeChecker.ATTIDX_MIXED];
    XInt finalAtt = (XInt) attrValues[XSAttributeChecker.ATTIDX_FINAL];
    fName = complexTypeName;
    fComplexTypeDecl.setName(fName);
    fTargetNamespace = schemaDoc.fTargetNamespace;
    fBlock = blockAtt == null ? schemaDoc.fBlockDefault : blockAtt.shortValue();
    fFinal = finalAtt == null ? schemaDoc.fFinalDefault : finalAtt.shortValue();
    //discard valid Block/Final 'Default' values that are invalid for Block/Final
    fBlock &= (XSConstants.DERIVATION_EXTENSION | XSConstants.DERIVATION_RESTRICTION);
    fFinal &= (XSConstants.DERIVATION_EXTENSION | XSConstants.DERIVATION_RESTRICTION);
    fIsAbstract = (abstractAtt != null && abstractAtt.booleanValue());
    fAnnotations = null;
    Element child = null;
    try {
        // ---------------------------------------------------------------
        // First, handle any ANNOTATION declaration and get next child
        // ---------------------------------------------------------------
        child = DOMUtil.getFirstChildElement(complexTypeDecl);
        if (child != null) {
            if (DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) {
                addAnnotation(traverseAnnotationDecl(child, attrValues, false, schemaDoc));
                child = DOMUtil.getNextSiblingElement(child);
            } else {
                String text = DOMUtil.getSyntheticAnnotation(complexTypeDecl);
                if (text != null) {
                    addAnnotation(traverseSyntheticAnnotation(complexTypeDecl, text, attrValues, false, schemaDoc));
                }
            }
            if (child != null && DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION)) {
                throw new ComplexTypeRecoverableError("s4s-elt-invalid-content.1", new Object[] { fName, SchemaSymbols.ELT_ANNOTATION }, child);
            }
        } else {
            String text = DOMUtil.getSyntheticAnnotation(complexTypeDecl);
            if (text != null) {
                addAnnotation(traverseSyntheticAnnotation(complexTypeDecl, text, attrValues, false, schemaDoc));
            }
        }
        // ---------------------------------------------------------------
        if (child == null) {
            //
            // EMPTY complexType with complexContent
            //
            // set the base to the anyType
            fBaseType = SchemaGrammar.fAnyType;
            fDerivedBy = XSConstants.DERIVATION_RESTRICTION;
            processComplexContent(child, mixedAtt.booleanValue(), false, schemaDoc, grammar);
        } else if (DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_SIMPLECONTENT)) {
            //
            // SIMPLE CONTENT
            //
            traverseSimpleContent(child, schemaDoc, grammar);
            Element elemTmp = DOMUtil.getNextSiblingElement(child);
            if (elemTmp != null) {
                String siblingName = DOMUtil.getLocalName(elemTmp);
                throw new ComplexTypeRecoverableError("s4s-elt-invalid-content.1", new Object[] { fName, siblingName }, elemTmp);
            }
        } else if (DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_COMPLEXCONTENT)) {
            traverseComplexContent(child, mixedAtt.booleanValue(), schemaDoc, grammar);
            Element elemTmp = DOMUtil.getNextSiblingElement(child);
            if (elemTmp != null) {
                String siblingName = DOMUtil.getLocalName(elemTmp);
                throw new ComplexTypeRecoverableError("s4s-elt-invalid-content.1", new Object[] { fName, siblingName }, elemTmp);
            }
        } else {
            //
            // We must have ....
            // GROUP, ALL, SEQUENCE or CHOICE, followed by optional attributes
            // Note that it's possible that only attributes are specified.
            //
            // set the base to the anyType
            fBaseType = SchemaGrammar.fAnyType;
            fDerivedBy = XSConstants.DERIVATION_RESTRICTION;
            processComplexContent(child, mixedAtt.booleanValue(), false, schemaDoc, grammar);
        }
    } catch (ComplexTypeRecoverableError e) {
        handleComplexTypeError(e.getMessage(), e.errorSubstText, e.errorElem);
    }
    if (DEBUG) {
        System.out.println(fName);
    }
    fComplexTypeDecl.setValues(fName, fTargetNamespace, fBaseType, fDerivedBy, fFinal, fBlock, fContentType, fIsAbstract, fAttrGrp, fXSSimpleType, fParticle, new XSObjectListImpl(fAnnotations, fAnnotations == null ? 0 : fAnnotations.length));
    return fComplexTypeDecl;
}

3. XSDComplexTypeTraverser#traverseGlobal()

Project: openjdk
File: XSDComplexTypeTraverser.java
/**
     * Traverse global complexType declarations
     *
     * @param Element
     * @param XSDocumentInfo
     * @param SchemaGrammar
     * @return XSComplexTypeDecXSComplexTypeDecl
     */
XSComplexTypeDecl traverseGlobal(Element complexTypeNode, XSDocumentInfo schemaDoc, SchemaGrammar grammar) {
    Object[] attrValues = fAttrChecker.checkAttributes(complexTypeNode, true, schemaDoc);
    String complexTypeName = (String) attrValues[XSAttributeChecker.ATTIDX_NAME];
    contentBackup();
    XSComplexTypeDecl type = traverseComplexTypeDecl(complexTypeNode, complexTypeName, attrValues, schemaDoc, grammar);
    contentRestore();
    // need to add the type to the grammar for later constraint checking
    grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode));
    if (complexTypeName == null) {
        reportSchemaError("s4s-att-must-appear", new Object[] { SchemaSymbols.ELT_COMPLEXTYPE, SchemaSymbols.ATT_NAME }, complexTypeNode);
        type = null;
    } else {
        if (grammar.getGlobalTypeDecl(type.getName()) == null) {
            grammar.addGlobalComplexTypeDecl(type);
        }
        // also add it to extended map
        final String loc = fSchemaHandler.schemaDocument2SystemId(schemaDoc);
        final XSTypeDefinition type2 = grammar.getGlobalTypeDecl(type.getName(), loc);
        if (type2 == null) {
            grammar.addGlobalComplexTypeDecl(type, loc);
        }
        // handle duplicates
        if (fSchemaHandler.fTolerateDuplicates) {
            if (type2 != null) {
                if (type2 instanceof XSComplexTypeDecl) {
                    type = (XSComplexTypeDecl) type2;
                }
            }
            fSchemaHandler.addGlobalTypeDecl(type);
        }
    }
    fAttrChecker.returnAttrArray(attrValues, schemaDoc);
    return type;
}