Package org.apache.beehive.netui.compiler.model.schema.validator11

Examples of org.apache.beehive.netui.compiler.model.schema.validator11.FormValidationDocument


       
       
        //
        // Create and initialize the document, or parse the given one (with which we'll merge).
        //
        FormValidationDocument doc;
       
        if ( mergeFile != null && mergeFile.canRead() )
        {
            doc = FormValidationDocument.Factory.parse( mergeFile );
        }
        else
        {
            doc = FormValidationDocument.Factory.newInstance();
        }
       
        XmlDocumentProperties dp = doc.documentProperties();
       
        if ( dp.getDoctypeName() == null )
        {
            dp.setDoctypeName( "form-validation" )// NOI18N
        }

        if ( dp.getDoctypePublicId() == null )
        {
            if ( _validatorVersion.equals( ValidatorVersion.oneZero ) )
            {
                dp.setDoctypePublicId( "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" );
            }
            else
            {
                dp.setDoctypePublicId( "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN" );
            }
        }

        if ( dp.getDoctypeSystemId() == null )
        {
            if ( _validatorVersion.equals( ValidatorVersion.oneZero ) )
            {
                dp.setDoctypeSystemId( "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd" );
            }
            else
            {
                dp.setDoctypeSystemId( "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd" );
            }
        }
       
       
        FormValidationDocument.FormValidation formValidationElement = doc.getFormValidation();
       
        if ( formValidationElement == null )
        {
            formValidationElement = doc.addNewFormValidation();
        }
       
       
        //
        // Write the "generated by" comment.
        //
        XmlCursor curs = formValidationElement.newCursor();       
        String headerComment = getHeaderComment( mergeFile );
        if ( headerComment != null ) curs.insertComment( headerComment );
               
       
        //
        // Now write out all the LocaleSets, which contain the forms/fields/rules.
        //
        writeLocaleSets( formValidationElement );
        writeLocaleSet( _defaultLocaleSet, formValidationElement );
       
        //
        // Write the file.
        //
        XmlOptions options = new XmlOptions();
        options.setSavePrettyPrint();
        doc.save( outputStream, options );
    }
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.compiler.model.schema.validator11.FormValidationDocument

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.