Package com.sun.xml.xsom

Examples of com.sun.xml.xsom.XSSimpleType


    private Column toColumn( final XSComponent xs )
    {
        Column col = null;
        boolean columnEmpty = true;

        XSSimpleType type = null;
        if ( xs instanceof XSParticle )
        {
            col = new Column();
            col.setNullable( ( (XSParticle) xs ).getMinOccurs() == 0 );
            columnEmpty = false;
        }
        else if ( xs instanceof XSSimpleType )
        {
            col = new Column();
            type = (XSSimpleType) xs;
        }
        else if ( xs instanceof XSAttributeDecl )
        {
            col = new Column();
            type = ( (XSAttributeDecl) xs ).getType();
        }
        else if ( xs instanceof XSAttributeUse )
        {
            final XSAttributeUse au = (XSAttributeUse) xs;
            col = new Column();
            col.setNullable( !au.isRequired() );
            columnEmpty = false;
            type = ( (XSAttributeUse) xs ).getDecl().getType();
        }
        else if ( xs instanceof XSElementDecl )
        {
            col = new Column();
            final XSElementDecl decl = (XSElementDecl) xs;
            col.setNullable( decl.isNillable() );
            columnEmpty = false;
            type = ( (XSElementDecl) xs ).getType().asSimpleType();
        }

        if ( type != null )
        {
            final XSFacet length = type.getFacet( XSFacet.FACET_LENGTH );
            final XSFacet maxLength = type.getFacet( XSFacet.FACET_MAXLENGTH );
            final XSFacet fractionDigits = type.getFacet( XSFacet.FACET_FRACTIONDIGITS );
            final XSFacet totalDigits = type.getFacet( XSFacet.FACET_TOTALDIGITS );

            if ( length != null )
            {
                col.setLength( new Integer( length.getValue().value ) );
                columnEmpty = false;
            }
            else if ( maxLength != null )
            {
                col.setLength( new Integer( maxLength.getValue().value ) );
                columnEmpty = false;
            }

            if ( fractionDigits != null )
            {
                col.setScale( new Integer( fractionDigits.getValue().value ) );
                columnEmpty = false;
            }
            if ( totalDigits != null )
            {
                col.setPrecision( new Integer( totalDigits.getValue().value ) );
                columnEmpty = false;
            }

            if ( this.getSchemaSimpleType( type, "decimal" ) != null
                 && ( col.getScale() == null || col.getPrecision() == null ) )
            {
                XSSimpleType schemaType = this.getSchemaSimpleType( type, "integer" );
                if ( schemaType != null && col.getScale() == null )
                {
                    col.setScale( new Integer( 0 ) );
                    columnEmpty = false;
                }
View Full Code Here


     *
     * @param type
     *      the simple type to be bound.
     */
    public TypeUse build( XSSimpleType type ) {
        XSSimpleType oldi = initiatingType;
        this.initiatingType = type;

        TypeUse e = checkRefererCustomization(type);
        if(e==null)
            e = compose(type);
View Full Code Here

     * A version of the {@link #build(XSSimpleType)} method
     * used to bind the definition of a class generated from
     * the given simple type.
     */
    public TypeUse buildDef( XSSimpleType type ) {
        XSSimpleType oldi = initiatingType;
        this.initiatingType = type;

        TypeUse e = type.apply(composer);

        initiatingType = oldi;
View Full Code Here

     */
    public void errorCheck() {
        ErrorReceiver er = Ring.get(ErrorReceiver.class);
        for (QName n : enumBaseTypes) {
            XSSchemaSet xs = Ring.get(XSSchemaSet.class);
            XSSimpleType st = xs.getSimpleType(n.getNamespaceURI(), n.getLocalPart());
            if(st==null) {
                er.error(loc,Messages.ERR_UNDEFINED_SIMPLE_TYPE.format(n));
                continue;
            }

View Full Code Here

        for( Map.Entry<QName,BIConversion> e : globalConversions.entrySet() ) {

            QName name = e.getKey();
            BIConversion conv = e.getValue();
           
            XSSimpleType st = schema.getSimpleType(name.getNamespaceURI(),name.getLocalPart());
            if(st==null) {
                Ring.get(ErrorReceiver.class).error(
                    getLocation(),
                    Messages.ERR_UNDEFINED_SIMPLE_TYPE.format(name)
                );
View Full Code Here

         public void listSimpleType(XSListSimpleType type) {
         }

         public void restrictionSimpleType(XSRestrictionSimpleType type) {
            XSSimpleType baseType = type.getSimpleBaseType();
            //System.out.println("Restriction " + type.getName() + " :" + baseType.getName());
            Iterator<?> itr = type.iterateDeclaredFacets();
            while (itr.hasNext()) {
               facet((XSFacet) itr.next());
            }
View Full Code Here

         visitAttribute(decl);
      }
   }

   private void visitAttribute(XSAttributeDecl decl) {
      XSSimpleType type = decl.getType();
      //System.out.println("Visiting attribute " + decl.getName() + ":" + type.getName());
      currentNode.addAttribute(decl);
      if (schema.getSimpleType(type.getName()) != null)
         simpleType(type);
   }
View Full Code Here

         visitAttribute(decl);
      }
   }

   private void visitAttribute(XSAttributeDecl decl) {
      XSSimpleType type = decl.getType();
      //System.out.println("Visiting attribute " + decl.getName() + ":" + type.getName());
      currentNode.addAttribute(decl);
      if (schema.getSimpleType(type.getName()) != null)
         simpleType(type);
   }
View Full Code Here

     *
     * @param decl           Attribute declaration.
     * @param additionalAtts Additional attributes.
     */
    private void dump(XSAttributeDecl decl, String additionalAtts) {
        XSSimpleType type = decl.getType();

        String str = MessageFormat.format("Attribute \"{0}\"{1}{2}{3}{4}",
                new Object[]{
                    decl.getName(),
                    additionalAtts,
                    type.isLocal() ? "" : MessageFormat.format(
                            " type=\"'{'{0}'}'{1}\"", new Object[]{
                                type.getTargetNamespace(),
                                type.getName()}),
                    decl.getFixedValue() == null ? "" : " fixed=\""
                + decl.getFixedValue() + "\"",
                    decl.getDefaultValue() == null ? "" : " default=\""
                + decl.getDefaultValue() + "\""});

        SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator());
        this.currNode.add(newNode);
        this.currNode = newNode;

        if (type.isLocal()) {
            simpleType(type);
        }
        this.currNode = (SchemaTreeNode) this.currNode.getParent();
    }
View Full Code Here

    /* (non-Javadoc)
     * @see com.sun.xml.xsom.visitor.XSSimpleTypeVisitor#listSimpleType(com.sun.xml.xsom.XSListSimpleType)
     */
    public void listSimpleType(XSListSimpleType type) {
        XSSimpleType itemType = type.getItemType();

        if (itemType.isLocal()) {
            SchemaTreeNode newNode = new SchemaTreeNode("List", type
                    .getLocator());
            this.currNode.add(newNode);
            this.currNode = newNode;
            simpleType(itemType);
            this.currNode = (SchemaTreeNode) this.currNode.getParent();
        }
        else {
            // global type
            String str = MessageFormat.format("List itemType=\"'{'{0}'}'{1}\"",
                    new Object[]{itemType.getTargetNamespace(),
                                 itemType.getName()});
            SchemaTreeNode newNode = new SchemaTreeNode(str, itemType
                    .getLocator());
            this.currNode.add(newNode);
        }
    }
View Full Code Here

TOP

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

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.