Search in sources :

Example 1 with XSContentType

use of com.sun.xml.xsom.XSContentType in project narayana by jbosstm.

the class NBFSchemaParser method findElementType.

private void findElementType(XSComplexType xtype) {
    XSContentType xsContentType = xtype.getContentType();
    XSParticle particle = xsContentType.asParticle();
    if (particle != null) {
        XSTerm term = particle.getTerm();
        if (term.isModelGroup()) {
            XSModelGroup xsModelGroup = term.asModelGroup();
            XSParticle[] particles = xsModelGroup.getChildren();
            for (XSParticle p : particles) {
                XSTerm pterm = p.getTerm();
                if (pterm.isElementDecl()) {
                    XSElementDecl element = pterm.asElementDecl();
                    String name = element.getName();
                    log.debug(name);
                    XSType type = element.getType();
                    while (type != null) {
                        String typeName = type.getName();
                        if (typeName != null && (typeName.equals("long") || typeName.equals("string") || typeName.equals("integer") || typeName.equals("float") || typeName.endsWith("_type"))) {
                            log.debug(typeName);
                            flds.put(name, typeName);
                            break;
                        }
                        type = type.getBaseType();
                    }
                }
            }
        }
    }
}
Also used : XSType(com.sun.xml.xsom.XSType) XSContentType(com.sun.xml.xsom.XSContentType) XSParticle(com.sun.xml.xsom.XSParticle) XSTerm(com.sun.xml.xsom.XSTerm) XSElementDecl(com.sun.xml.xsom.XSElementDecl) XSModelGroup(com.sun.xml.xsom.XSModelGroup)

Example 2 with XSContentType

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

the class AtlasRewritingXSVisitor method complexType.

@Override
public void complexType(XSComplexType complex) {
    for (XSAttributeUse use : complex.getAttributeUses()) {
        attributeUse(use);
    }
    XSContentType contentType = complex.getContentType();
    contentType.visit(this);
}
Also used : XSContentType(com.sun.xml.xsom.XSContentType) XSAttributeUse(com.sun.xml.xsom.XSAttributeUse)

Aggregations

XSContentType (com.sun.xml.xsom.XSContentType)2 XSAttributeUse (com.sun.xml.xsom.XSAttributeUse)1 XSElementDecl (com.sun.xml.xsom.XSElementDecl)1 XSModelGroup (com.sun.xml.xsom.XSModelGroup)1 XSParticle (com.sun.xml.xsom.XSParticle)1 XSTerm (com.sun.xml.xsom.XSTerm)1 XSType (com.sun.xml.xsom.XSType)1