Refine search
public boolean isApplicable(XSComplexType ct) { if (!bgmBuilder.isGenerateMixedExtensions()) return false; XSType bt = ct.getBaseType(); if (bt.isComplexType() && bt.asComplexType().isMixed() && ct.isMixed() && ct.getDerivationMethod()==XSType.EXTENSION && ct.getContentType().asParticle() != null && ct.getExplicitContent().asEmpty() == null ) { return true; } return false; }
public void complexType(XSComplexType ct) { if(!visited.add(ct)) return; refer(ct,ct.getBaseType()); ct.getBaseType().visit(this); ct.getContentType().visit(this); }
protected void processComplexType(XSComplexType complexType, ParseContext parseContext) throws Exception { XSParticle particle = complexType.getContentType().asParticle(); if (particle != null) { processParticle(particle, parseContext); } XSSimpleType xsSimpleType = complexType.getContentType().asSimpleType(); if (xsSimpleType != null) { processText("value", xsSimpleType, parseContext); } Collection<? extends XSAttributeUse> c = complexType.getAttributeUses(); Iterator<? extends XSAttributeUse> i = c.iterator(); while(i.hasNext()) { XSAttributeUse attUse = i.next(); processAttribute(attUse, parseContext); } }
if (type.getContentType().asSimpleType() != null) { .getContentType().getLocator()); this.currNode.add(newNode2); this.currNode = newNode2; baseType.getTargetNamespace(), baseType.getName()}); SchemaTreeNode newNode3 = new SchemaTreeNode(str, baseType .getLocator()); this.currNode.add(newNode3); this.currNode = newNode3; type.getContentType().getLocator()); this.currNode.add(newNode2); this.currNode = newNode2; this.currNode = newNode3; type.getContentType().visit(this); dumpComplexTypeAttribute(type); type.getExplicitContent().visit(this); dumpComplexTypeAttribute(type);
public void complexType( XSComplexType type ) { println(MessageFormat.format("<complexType{0}>", type.isLocal()?"":" name=\""+type.getName()+'\"')); indent++; if(type.getContentType().asSimpleType()!=null) { baseType.getTargetNamespace(), baseType.getName())); indent++; baseType.getTargetNamespace(), baseType.getName())); indent++; type.getContentType().visit(this); dumpComplexTypeAttribute(type); type.getExplicitContent().visit(this); dumpComplexTypeAttribute(type);
public void run() throws SAXException { XSType t = baseType.getType(); if (t.isComplexType() && t.asComplexType().getContentType().asParticle()!=null) { $runtime.reportError( Messages.format(Messages.ERR_SIMPLE_CONTENT_EXPECTED, t.getTargetNamespace(), t.getName()), loc); } } });
public boolean isApplicable(XSComplexType ct) { XSType bt = ct.getBaseType(); if(bt ==schemas.getAnyType() && ct.isMixed()) return true; // fresh mixed complex type // there's no complex type in the inheritance tree yet if (bt.isComplexType() && !bt.asComplexType().isMixed() && ct.isMixed() && ct.getDerivationMethod() == XSType.EXTENSION) { if (!bgmBuilder.isGenerateMixedExtensions() && (ct.getContentType().asParticle() == null)) { return false; } return true; } return false; }
public void build(XSComplexType ct) { XSContentType contentType = ct.getContentType(); if (!(ct.getBaseType() == schemas.getAnyType() && ct.isMixed())) { XSComplexType baseType = ct.getBaseType().asComplexType(); selector.getCurrentBean().setBaseClass(baseClass); boolean isSubtyped = (cType != null) && (cType.size() > 0); if (contentType.asEmpty() != null) { if (isSubtyped) { p = prop.createContentExtendedMixedReferenceProperty("Content", ct, null); p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null); } else if (contentType.asParticle() == null) { p = prop.createContentExtendedMixedReferenceProperty("Content", ct, null); } else { RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(), false); p = prop.createContentExtendedMixedReferenceProperty("Content", ct, ts); if(contentType.asEmpty()!=null) { p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null); } else { RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false); p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false); selector.getCurrentBean().addProperty(p);
public void build(XSComplexType ct) { XSComplexType baseType = ct.getBaseType().asComplexType(); // build the base class CClass baseClass = selector.bindToType(baseType, ct, true); assert baseClass != null; // global complex type must map to a class if (!checkIfExtensionSafe(baseType, ct)) { // error. We can't handle any further extension errorReceiver.error(ct.getLocator(), Messages.ERR_NO_FURTHER_EXTENSION.format( baseType.getName(), ct.getName() ) ); return; } selector.getCurrentBean().setBaseClass(baseClass); builder.recordBindingMode(ct, ComplexTypeBindingMode.FALLBACK_EXTENSION); BIProperty prop = BIProperty.getCustomization(ct); CPropertyInfo p; RawTypeSet ts = RawTypeSetBuilder.build(ct.getContentType().asParticle(), false); p = prop.createDummyExtendedMixedReferenceProperty("contentOverrideFor" + ct.getName(), ct, ts); selector.getCurrentBean().addProperty(p); // adds attributes and we are through. green.attContainer(ct); }
XSComplexType baseType = ct.getBaseType().asComplexType(); assert baseClass!=null; // global complex type must map to a class selector.getCurrentBean().setBaseClass(baseClass); boolean forceFallbackInExtension = baseType.isMixed() && ct.isMixed() && (ct.getExplicitContent() != null) && bgmBuilder.inExtensionMode; CPropertyInfo p; XSParticle particle = ct.getContentType().asParticle(); if (particle != null) { RawTypeSet ts = RawTypeSetBuilder.build(particle, false); p = prop.createDummyExtendedMixedReferenceProperty("Content", ct, ts); selector.getCurrentBean().addProperty(p);
public boolean isApplicable(XSComplexType ct) { if (!bgmBuilder.model.options.contentForWildcard) { return false; } XSType bt = ct.getBaseType(); if (bt ==schemas.getAnyType() && ct.getContentType() != null) { XSParticle part = ct.getContentType().asParticle(); if ((part != null) && (part.getTerm().isModelGroup())) { XSParticle[] parts = part.getTerm().asModelGroup().getChildren(); int wildcardCount = 0; int i = 0; while ((i < parts.length) && (wildcardCount <= 1)) { if (parts[i].getTerm().isWildcard()) { wildcardCount += 1; } i++; } return (wildcardCount > 1); } } return false; }
public boolean isApplicable(XSComplexType ct) { if( !bgmBuilder.getGlobalBinding().isChoiceContentPropertyEnabled() ) return false; if( ct.getBaseType()!=schemas.getAnyType() ) // My reading of the spec is that if a complex type is // derived from another complex type by extension, // its top level model group is always a sequence // that combines the base type content model and // the extension defined in the new complex type. return false; XSParticle p = ct.getContentType().asParticle(); if(p==null) return false; XSModelGroup mg = getTopLevelModelGroup(p); if( mg.getCompositor()!=XSModelGroup.CHOICE ) return false; if( p.isRepeated() ) return false; return true; }
Iterator<? extends XSAttGroupDecl> itagd; ity = sset.iterateTypes(); while (ity.hasNext()) { xt = ity.next(); if (xt.getBaseType() == cType) { type = xt.asComplexType(); particle = type.getContentType().asParticle(); if (particle != null) { write(st, particle.getTerm(), false, sset); itagd = type.getAttGroups().iterator(); while (itagd.hasNext()) { write(st, itagd.next(), false); itau = type.getAttributeUses().iterator(); while (itau.hasNext()) { att = itau.next(); processInheritance(st, xt.asComplexType(), sset);
private boolean containingChoice(CClassInfo typeBean) { XSComponent component = typeBean.getSchemaComponent(); if (component instanceof XSComplexType) { XSContentType contentType = ((XSComplexType) component).getContentType(); XSParticle particle = contentType.asParticle(); if (particle != null) { XSTerm term = particle.getTerm(); XSModelGroup modelGroup = term.asModelGroup(); if (modelGroup != null) { return (modelGroup.getCompositor() == XSModelGroup.Compositor.CHOICE); } } } return false; }
public void build(XSComplexType ct) { XSComplexType baseType = ct.getBaseType().asComplexType(); assert baseClass != null; // global complex type must map to a class selector.getCurrentBean().setBaseClass(baseClass); XSContentType explicitContent = ct.getExplicitContent(); errorReceiver.error(ct.getLocator(), Messages.ERR_NO_FURTHER_EXTENSION.format( baseType.getName(), ct.getName() ) if (explicitContent != null && explicitContent.asParticle() != null) { if (baseTypeFlag == ComplexTypeBindingMode.NORMAL) { bgmBuilder.getParticleBinder().checkFallback(explicitContent.asParticle()) ? ComplexTypeBindingMode.FALLBACK_REST : ComplexTypeBindingMode.NORMAL); bgmBuilder.getParticleBinder().build(explicitContent.asParticle());
try { XSSchemaSet xss = new ModelLoader(opt, new JCodeModel(), receiver).loadXMLSchema(); Iterator<XSComplexType> it = xss.iterateComplexTypes(); while (it.hasNext()) { XSComplexType ct = it.next(); XSParticle p = ct.getContentType().asParticle(); if(p==null) continue; System.out.println("Graph for "+ct.getName()); System.out.println(tree.toString()); Graph g = new Graph(tree);
private static Collection<? extends XSDeclaration> findModelGroups(final XSComplexType complexType) { XSContentType contentType = complexType.getExplicitContent(); if (contentType == null) { contentType = complexType.getContentType(); } final XSParticle particle = contentType.asParticle(); if (particle != null && !particle.isRepeated()) { final XSTerm term = particle.getTerm(); if (term instanceof XSModelGroupDecl) { return Collections.singletonList((XSModelGroupDecl)term); } else { final XSModelGroup modelGroup = term.asModelGroup(); return modelGroup != null ? findModelGroups(modelGroup) : Collections.<XSModelGroupDecl>emptyList(); } } else { return Collections.emptyList(); } }
public Iterator<T> complexType(XSComplexType type) { // compensate particle XSParticle p = type.getContentType().asParticle(); if(p!=null) return particle(p); else return empty(); }
/** * Gets a {@link NameClass} that represents all the terms in the given content type. * If t is not a particle, just return an empty name class. */ private NameClass getNameClass(XSContentType t) { if(t==null) return NameClass.NULL; XSParticle p = t.asParticle(); if(p==null) return NameClass.NULL; else return p.getTerm().apply(contentModelNameClassBuilder); }
private void write(Struct st, XSComplexType type, boolean goingup, XSSchemaSet xss) { XSParticle particle; Iterator<? extends XSAttributeUse> it; XSAttributeUse att; XSAttributeDecl decl; Iterator<? extends XSAttGroupDecl> itt; particle = type.getContentType().asParticle(); if (particle != null) { write(st, particle.getTerm(), true, xss); } itt = type.getAttGroups().iterator(); while (itt.hasNext()) { write(st, itt.next(), true); } it = type.getAttributeUses().iterator(); while (it.hasNext()) { att = it.next(); decl = att.getDecl(); write(st, decl, goingup && att.isRequired()); } }