Package org.jibx.schema

Examples of org.jibx.schema.TreeWalker


            public void exit(UnionElement node) {
                replaceSimpleType(node);
            }
           
        };
        TreeWalker wlkr = new TreeWalker(null, new SchemaContextTracker());
        for (Iterator iter = m_validationContext.iterateSchemas(); iter.hasNext();) {
            wlkr.walkElement((SchemaElement)iter.next(), visitor);
        }
       
//        // TODO: test code for annotating schema
//        try {
//            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
View Full Code Here


            }
           
        }
       
        // finish by flagging global definitions requiring separate classes
        TreeWalker wlkr = new TreeWalker(null, new SchemaContextTracker());
        for (Iterator iter = m_validationContext.iterateSchemas(); iter.hasNext();) {
            SchemaElement schema = (SchemaElement)iter.next();
            SchemaCustom custom = ((SchemaExtension)schema.getExtension()).getCustom();
            if (custom.isGenerateAll()) {
                int count = schema.getChildCount();
                for (int i = 0; i < count; i++) {
                   
                    // check if this global needs a class
                    SchemaBase comp = schema.getChild(i);
                    boolean include = false;
                    switch (comp.type()) {
/*                        case SchemaBase.ATTRIBUTE_TYPE:
                            include = !custom.isAttributeInlined();
                            break;  */
                       
                        case SchemaBase.ATTRIBUTEGROUP_TYPE:
                        case SchemaBase.GROUP_TYPE:
                           
                            // for attribute group or group, only force separate class if multiple components
                            ValueCountVisitor visitor = new ValueCountVisitor();
                            wlkr.walkChildren(comp, visitor);
                            include = visitor.getCount() > 1;
                            break;
                           
                        case SchemaBase.COMPLEXTYPE_TYPE:
                        case SchemaBase.ELEMENT_TYPE:
View Full Code Here

     *
     * @return <code>true</code> if no-namespace used, <code>false</code> if not
     */
    private boolean checkNoNamespacedUsed() {
        SchemaNameVisitor visitor = new SchemaNameVisitor();
        TreeWalker walker = new TreeWalker(null, new SchemaContextTracker());
        for (Iterator iter = m_validationContext.iterateSchemas(); iter.hasNext();) {
            walker.walkSchema((SchemaElement)iter.next(), visitor);
        }
        return visitor.isNoNamespaceUsed();
    }
View Full Code Here

            prefixes[fill] = m_schemaPrefix;
            indexes[fill] = m_schemaIndex;
           
            // build schema extracts from main component and all referenced components
            String clasname = group.getGenerateClass().getFullName();
            TreeWalker walker = new TreeWalker(null, new SchemaContextTracker());
            boolean ref = false;
            List list = refcomps.asList();
            for (Iterator iter = list.iterator(); iter.hasNext();) {
               
                // add a blank line separating components
                if (ref) {
                    strwriter.write(COMMENT_LEAD_TEXT);
                } else {
                    ref = true;
                }
               
                // add any necessary namespace declarations
                AnnotatedBase comp = (AnnotatedBase)iter.next();
                for (Iterator jter = uritoprefix.keySet().iterator(); jter.hasNext();) {
                    String uri = (String)jter.next();
                    comp.addNamespaceDeclaration((String)uritoprefix.get(uri), uri);
                }
               
                // write the documentation
                DocumentationVisitor visitor = new DocumentationVisitor(comptoclas, clasname, comp, dropanno, ref,
                    indexes, prefixes);
                walker.walkElement(comp, visitor);
                strwriter.flush();
               
            }
           
            // convert generated schema fragment to plain text for embedding
View Full Code Here

TOP

Related Classes of org.jibx.schema.TreeWalker

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.