Package com.sun.xml.xsom

Examples of com.sun.xml.xsom.XSComplexType


    public List<XSComplexType> getSubtypes() {
        ArrayList subtypeList = new ArrayList();
        Iterator<XSComplexType> cTypes = getRoot().iterateComplexTypes();
        while (cTypes.hasNext()) {
            XSComplexType cType= cTypes.next();
            XSType base = cType.getBaseType();
            if ((base != null) && (base.equals(this))) {
                subtypeList.add(cType);
            }
        }
        return subtypeList;
View Full Code Here


                ,null,1,1);
        public List<XSComplexType> getSubtypes() {
            ArrayList subtypeList = new ArrayList();
            Iterator<XSComplexType> cTypes = getRoot().iterateComplexTypes();
            while (cTypes.hasNext()) {
                XSComplexType cType= cTypes.next();
                XSType base = cType.getBaseType();
                if ((base != null) && (base.equals(this))) {
                    subtypeList.add(cType);
                }
            }
            return subtypeList;
View Full Code Here

    private static boolean isSubstitutable( XSType _base, XSType derived ) {
        // too ugly to the point that it's almost unbearable.
        // I mean, it's not even transitive. Thus we end up calling this method
        // for each candidate
        if( _base.isComplexType() ) {
            XSComplexType base = _base.asComplexType();
           
            for( ; base!=derived; derived=derived.getBaseType() ) {
                if( base.isSubstitutionProhibited( derived.getDerivationMethod() ) )
                    return false;    // Type Derivation OK (Complex)-1
            }
            return true;
        } else {
            // simple type don't have any @block
View Full Code Here

            SchemaTreeNode newNode2 = new SchemaTreeNode("Complex content",
                    type.getContentType().getLocator());
            this.currNode.add(newNode2);
            this.currNode = newNode2;

            XSComplexType baseType = type.getBaseType().asComplexType();

            if (type.getDerivationMethod() == XSType.RESTRICTION) {
                // restriction
                String str = MessageFormat.format(
                        "Restriction base=\"<{0}>{1}\"", new Object[]{
                            baseType.getTargetNamespace(),
                            baseType.getName()});
                SchemaTreeNode newNode3 = new SchemaTreeNode(str,
                        baseType.getLocator());
                this.currNode.add(newNode3);
                this.currNode = newNode3;

                type.getContentType().visit(this);
                dumpComplexTypeAttribute(type);

                this.currNode = (SchemaTreeNode) this.currNode.getParent();
            }
            else {
                // extension
                String str = MessageFormat.format(
                        "Extension base=\"'{'{0}'}'{1}\"", new Object[]{
                            baseType.getTargetNamespace(),
                            baseType.getName()});
                SchemaTreeNode newNode3 = new SchemaTreeNode(str,
                        baseType.getLocator());
                this.currNode.add(newNode3);
                this.currNode = newNode3;

                // check if have redefine tag
                if ((type.getTargetNamespace().compareTo(
                        baseType.getTargetNamespace()) ==
                        0)
                        && (type.getName().compareTo(baseType.getName()) == 0)) {
                    SchemaTreeNode newNodeRedefine = new SchemaTreeNode(
                            "redefine", type
                            .getLocator());
                    this.currNode.add(newNodeRedefine);
                    this.currNode = newNodeRedefine;
                    baseType.visit(this);
                    this.currNode =
                            (SchemaTreeNode) newNodeRedefine.getParent();
                }

                type.getExplicitContent().visit(this);
View Full Code Here

    private static boolean isSubstitutable( XSType _base, XSType derived ) {
        // too ugly to the point that it's almost unbearable.
        // I mean, it's not even transitive. Thus we end up calling this method
        // for each candidate
        if( _base.isComplexType() ) {
            XSComplexType base = _base.asComplexType();
           
            for( ; base!=derived; derived=derived.getBaseType() ) {
                if( base.isSubstitutionProhibited( derived.getDerivationMethod() ) )
                    return false;    // Type Derivation OK (Complex)-1
            }
            return true;
        } else {
            // simple type don't have any @block
View Full Code Here

        return o;
    }

    public Iterator<XSAttributeUse> iterateAttributeUses() {
       
        XSComplexType baseType = getBaseType().asComplexType();
       
        if( baseType==null )    return super.iterateAttributeUses();
       
        return new Iterators.Union<XSAttributeUse>(
            new Iterators.Filter<XSAttributeUse>(baseType.iterateAttributeUses()) {
                protected boolean matches(XSAttributeUse value) {
                    XSAttributeDecl u = value.getDecl();
                    UName n = new UName(u.getTargetNamespace(),u.getName());
                    return !prohibitedAtts.contains(n);
                }
View Full Code Here

        } else {
            // complex content
            println("<complexContent>");
            indent++;

            XSComplexType baseType = type.getBaseType().asComplexType();

            if(type.getDerivationMethod()==XSType.RESTRICTION) {
                // restriction
                println(MessageFormat.format("<restriction base=\"'{'{0}'}'{1}\">",
                    new Object[]{
                        baseType.getTargetNamespace(),
                        baseType.getName() }));
                indent++;

                type.getContentType().visit(this);
                dumpComplexTypeAttribute(type);

                indent--;
                println("</restriction>");
            } else {
                // extension
                println(MessageFormat.format("<extension base=\"'{'{0}'}'{1}\">",
                    new Object[]{
                        baseType.getTargetNamespace(),
                        baseType.getName() }));

                // check if have redefine - Kirill
                if( type.isGlobal()
                && type.getTargetNamespace().equals(baseType.getTargetNamespace())
                && type.getName().equals(baseType.getName())) {
                    indent++;
                    println("<redefine>");
                    indent++;
                    baseType.visit(this);
                    indent--;
                    println("</redefine>");
                    indent--;
                }
View Full Code Here

            new FreshComplexTypeBuilder().build(ct);
            return;
        }


        XSComplexType baseType = ct.getBaseType().asComplexType();

        // build the base class
        CClass baseClass = selector.bindToType(baseType,ct,true);
        assert baseClass!=null;   // global complex type must map to a class
View Full Code Here

            &&  baseType.isComplexType()
            &&  ct.getDerivationMethod()==XSType.EXTENSION;
    }

    public void build(XSComplexType ct) {
        XSComplexType baseType = ct.getBaseType().asComplexType();

        // build the base class
        CClass baseClass = selector.bindToType(baseType,ct,true);
        assert baseClass!=null;   // global complex type must map to a class

        selector.getCurrentBean().setBaseClass(baseClass);

        // derivation by extension.
        ComplexTypeBindingMode baseTypeFlag = builder.getBindingMode(baseType);

        XSContentType explicitContent = ct.getExplicitContent();

        if(!checkIfExtensionSafe(baseType,ct)) {
            // error. We can't handle any further extension
            errorReceiver.error( ct.getLocator(),
                Messages.ERR_NO_FURTHER_EXTENSION.format(
                    baseType.getName(), ct.getName() )
            );
            return;
        }

View Full Code Here

     *
     * @return false
     *      If this complex type needs to be rejected.
     */
    private boolean checkIfExtensionSafe( XSComplexType baseType, XSComplexType thisType ) {
        XSComplexType lastType = getLastRestrictedType(baseType);

        if(lastType==null)
            return true;    // no restriction in derivation chain

        NameClass anc = NameClass.NULL;
        // build name class for attributes in new complex type
        Iterator itr = thisType.iterateDeclaredAttributeUses();
        while( itr.hasNext() )
            anc = new ChoiceNameClass( anc, getNameClass(((XSAttributeUse)itr.next()).getDecl()) );
        // TODO: attribute wildcard

        NameClass enc = getNameClass(thisType.getExplicitContent());

        // check against every base type ... except the root anyType
        while(lastType!=lastType.getBaseType()) {
            if(checkCollision(anc,enc,lastType))
                return false;

            if(lastType.getBaseType().isSimpleType())
                // if the base type is a simple type, there won't be
                // any further name collision.
                return true;

            lastType = lastType.getBaseType().asComplexType();
        }



        return true;    // OK
View Full Code Here

TOP

Related Classes of com.sun.xml.xsom.XSComplexType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.