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); } } });
private void processTermElement(JFieldVar fieldVar, XSElementDecl element, List<FacetCustomization> customizations) { XSType elementType = element.getType(); if (elementType.isComplexType()) { validAnnotate(fieldVar); if (!element.isNillable()) notNullAnnotate(fieldVar); if (elementType.getBaseType().isSimpleType()) processSimpleType(elementType.getBaseType().asSimpleType(), fieldVar, customizations); } else processSimpleType(elementType.asSimpleType(), fieldVar, customizations); }
private QName getType(XSType xsType) { if (xsType.getName() == null) { return null; } return new QName(xsType.getTargetNamespace(), xsType.getName()); }
private QName determineSupertype(XSType type) { XSType baseType = type.getBaseType(); if (baseType == null) { return null; } if (baseType.getName().equals("anyType")) { return null; } return new QName(baseType.getTargetNamespace(), baseType.getName()); }
protected static String getAnonymousTypeName(XSType type, String fieldName) { if (type.isComplexType()) { XSElementDecl container = type.asComplexType().getScope(); String elName = container.getName(); return elName + ANONYMOUS_TYPE_SUFFIX; } else { return fieldName + ANONYMOUS_TYPE_SUFFIX; } }
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); }
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 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 boolean isApplicable(XSComplexType ct) { XSType baseType = ct.getBaseType(); return baseType!=schemas.getAnyType() && baseType.isComplexType() && ct.getDerivationMethod()==XSType.EXTENSION; }
private Map<QName, List<QName>> getComplexTypeToElementName(ClassOutline classOutline) { Map<QName, List<QName>> complexTypeToElementName = new HashMap<>(); XSSchemaSet schemaSet = classOutline.target.getSchemaComponent().getRoot(); for (XSSchema schema : schemaSet.getSchemas()) { Map<String, XSElementDecl> elemDecls = schema.getElementDecls(); for (Entry<String, XSElementDecl> entry : elemDecls.entrySet()) { XSElementDecl decl = entry.getValue(); XSType xsType = decl.getType(); if (xsType.getName() == null) { continue; } QName type = new QName(xsType.getTargetNamespace(), xsType.getName()); List<QName> qnames = complexTypeToElementName.get(type); if (qnames == null) { qnames = new ArrayList<>(); complexTypeToElementName.put(type, qnames); } qnames.add(new QName(decl.getTargetNamespace(), decl.getName())); } } return complexTypeToElementName; }
private void elementDecl( XSElementDecl decl, String extraAtts ) { XSType type = decl.getType(); // TODO: various other attributes // qualified attr; Issue if(decl.getForm() != null) { extraAtts += " form=\"" + (decl.getForm() ? "qualified" : "unqualified" ) + "\""; } println(MessageFormat.format("<element name=\"{0}\"{1}{2}{3}>", decl.getName(), type.isLocal()?"":" type=\"{"+ type.getTargetNamespace()+'}'+ type.getName()+'\"', extraAtts, type.isLocal()?"":"/")); if(type.isLocal()) { indent++; if(type.isLocal()) type.visit(this); indent--; println("</element>"); } }
/** * Determines if the given component needs to have a value * constructor (a constructor that takes a parmater.) on ObjectFactory. */ private boolean needValueConstructor( XSComponent sc ) { if(!(sc instanceof XSElementDecl)) return false; XSElementDecl decl = (XSElementDecl)sc; if(!decl.getType().isSimpleType()) return false; return true; }
public void complexType(XSComplexType ct) { if(!visited.add(ct)) return; refer(ct,ct.getBaseType()); ct.getBaseType().visit(this); ct.getContentType().visit(this); }
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); selector.getCurrentBean().addProperty(p);
public XSContentType getContentType() { XSType t = baseType.getType(); if(t.asComplexType()!=null) return t.asComplexType().getContentType(); else return t.asSimpleType(); }
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);
@Override public void elementDecl(XSElementDecl decl) { if (localName.equals(decl.getName()) && schema.getTargetNamespace().equals(decl.getTargetNamespace())) elements.add(new ElementDecl(decl, Schema.this)); if (decl.getType().isLocal() && shouldWalk() && addToVisited(decl.getType())) decl.getType().visit(this); }
public void build(XSComplexType ct) { assert ct.getDerivationMethod()==XSType.EXTENSION; // base type is a simple type XSSimpleType baseType = ct.getBaseType().asSimpleType(); // determine the binding of this complex type. builder.recordBindingMode(ct,ComplexTypeBindingMode.NORMAL); simpleTypeBuilder.refererStack.push(ct); TypeUse use = simpleTypeBuilder.build(baseType); simpleTypeBuilder.refererStack.pop(); BIProperty prop = BIProperty.getCustomization(ct); CPropertyInfo p = prop.createValueProperty("Value",false,baseType,use, BGMBuilder.getName(baseType)); selector.getCurrentBean().addProperty(p); // adds attributes and we are through. green.attContainer(ct); }
private void interpretElement(XSElementDecl el, XSSchemaSet sset) { XSComplexType cType; XSSimpleType xs; if (el.getType() instanceof XSComplexType && el.getType() != sset.getAnyType()) { cType = (XSComplexType) el.getType(); processComplexType(cType, el.getName(), sset); } else if (el.getType() instanceof XSSimpleType && el.getType() != sset.getAnySimpleType()) { xs = el.getType().asSimpleType(); processSimpleType(xs, el.getName()); } }