Search in sources :

Example 6 with XSModelGroupDecl

use of com.sun.xml.xsom.XSModelGroupDecl in project atlasmap by atlasmap.

the class SchemaTreeTraverser method particle.

/* (non-Javadoc)
     * @see com.sun.xml.xsom.visitor.XSContentTypeVisitor#particle(com.sun.xml.xsom.XSParticle)
     */
public void particle(XSParticle part) {
    BigInteger i;
    StringBuffer buf = new StringBuffer();
    i = part.getMaxOccurs();
    if (i.equals(BigInteger.valueOf(XSParticle.UNBOUNDED))) {
        buf.append(" maxOccurs=\"unbounded\"");
    } else {
        if (!i.equals(BigInteger.ONE)) {
            buf.append(" maxOccurs=\"" + i + "\"");
        }
    }
    i = part.getMinOccurs();
    if (!i.equals(BigInteger.ONE)) {
        buf.append(" minOccurs=\"" + i + "\"");
    }
    final String extraAtts = buf.toString();
    part.getTerm().visit(new XSTermVisitor() {

        public void elementDecl(XSElementDecl decl) {
            if (decl.isLocal()) {
                SchemaTreeTraverser.this.elementDecl(decl, extraAtts);
            } else {
                // reference
                SchemaTreeNode newNode = new SchemaTreeNode(MessageFormat.format("Element ref=\"'{'{0}'}'{1}\"{2}", new Object[] { decl.getTargetNamespace(), decl.getName(), extraAtts }), decl.getLocator());
                currNode.add(newNode);
            }
        }

        public void modelGroupDecl(XSModelGroupDecl decl) {
            // reference
            SchemaTreeNode newNode = new SchemaTreeNode(MessageFormat.format("Group ref=\"'{'{0}'}'{1}\"{2}", new Object[] { decl.getTargetNamespace(), decl.getName(), extraAtts }), decl.getLocator());
            currNode.add(newNode);
        }

        public void modelGroup(XSModelGroup group) {
            SchemaTreeTraverser.this.modelGroup(group, extraAtts);
        }

        public void wildcard(XSWildcard wc) {
            SchemaTreeTraverser.this.wildcard(wc, extraAtts);
        }
    });
}
Also used : XSModelGroupDecl(com.sun.xml.xsom.XSModelGroupDecl) BigInteger(java.math.BigInteger) XSElementDecl(com.sun.xml.xsom.XSElementDecl) XSWildcard(com.sun.xml.xsom.XSWildcard) XSTermVisitor(com.sun.xml.xsom.visitor.XSTermVisitor) XSModelGroup(com.sun.xml.xsom.XSModelGroup)

Aggregations

XSModelGroupDecl (com.sun.xml.xsom.XSModelGroupDecl)6 XSElementDecl (com.sun.xml.xsom.XSElementDecl)4 XSComplexType (com.sun.xml.xsom.XSComplexType)3 XSSimpleType (com.sun.xml.xsom.XSSimpleType)3 XSAttGroupDecl (com.sun.xml.xsom.XSAttGroupDecl)2 XSAttributeDecl (com.sun.xml.xsom.XSAttributeDecl)2 XSModelGroup (com.sun.xml.xsom.XSModelGroup)2 XSWildcard (com.sun.xml.xsom.XSWildcard)2 XSTermVisitor (com.sun.xml.xsom.visitor.XSTermVisitor)2 BigInteger (java.math.BigInteger)2 XSSchema (com.sun.xml.xsom.XSSchema)1 XSSchemaSet (com.sun.xml.xsom.XSSchemaSet)1 XSOMParser (com.sun.xml.xsom.parser.XSOMParser)1 Iterator (java.util.Iterator)1 SAXException (org.xml.sax.SAXException)1