@Override public Multiplicity attributeUse(XSAttributeUse use) { return use.isRequired() ? Multiplicity.ONE : Multiplicity.OPTIONAL; }
@Override public Multiplicity attributeUse(XSAttributeUse use) { return use.isRequired() ? Multiplicity.ONE : Multiplicity.OPTIONAL; }
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()); } }
private void write(Struct st, XSAttGroupDecl attGroup, boolean goingup) { Iterator<? extends XSAttributeUse> it; Iterator<? extends XSAttGroupDecl> itg; XSAttributeUse att; XSAttributeDecl decl; itg = attGroup.getAttGroups().iterator(); while (itg.hasNext()) { write(st, itg.next(), goingup); } it = attGroup.getDeclaredAttributeUses().iterator(); while (it.hasNext()) { att = it.next(); decl = att.getDecl(); if (decl.getType().getName() == null) { if (decl.getType().isRestriction()) { String typeName = processSimpleType(decl.getType(), decl.getName()); st.addField(decl.getName(), typeName, (goingup && att.isRequired()), false, decl.getFixedValue(), xsdMapping); } } else { write(st, decl, att.isRequired()); } } }
private void processAttribute(XSAttributeUse attributeUse, ParseContext parseContext) throws Exception { XSAttributeDecl attributeDecl = attributeUse.getDecl(); XSSimpleType xsSimpleType = attributeDecl.getType(); ParseContext attributeContext = new ParseContext(); if (attributeUse.isRequired()){ attributeContext.minOccurs = 1; } else { attributeContext.minOccurs = 0; } attributeContext.currentClass = parseContext.currentClass; attributeContext.maxOccurs = 1; attributeContext.path = parseContext.path + "/@" + attributeDecl.getName(); System.out.print(parseContext.indent + "[Attribute " + attributeContext.path + " " + attributeContext.getOccurs() + "] of type [" + xsSimpleType.getName() + "]"); addSimpleType(attributeDecl.getName(), xsSimpleType, attributeContext, ElementType.ATTRIBUTE); }
protected void loadAttributes(Schema schema, XSComplexType xsct, ComplexType ct) throws TypeBindingException { Collection<? extends XSAttributeUse> attrs = xsct.getAttributeUses(); for (XSAttributeUse attr : attrs) { XSAttributeDecl at = attr.getDecl(); Type fieldType = loadType(schema, at.getType(), at.getName()); if (fieldType == null) { throw new TypeBindingException("Cannot add type for '" + at.getName() + "'"); } createField(ct, at, fieldType, !attr.isRequired()); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse(XSAttributeUse use) { XSAttributeDecl decl = use.getDecl(); String additionalAtts = ""; if (use.isRequired()) { additionalAtts += " use=\"required\""; } if (use.getFixedValue() != null && use.getDecl().getFixedValue() == null) { additionalAtts += " fixed=\"" + use.getFixedValue() + "\""; } if (use.getDefaultValue() != null && use.getDecl().getDefaultValue() == null) { additionalAtts += " default=\"" + use.getDefaultValue() + "\""; } if (decl.isLocal()) { // this is anonymous attribute use dump(decl, additionalAtts); } else { // reference to a global one String str = MessageFormat.format( "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{ decl.getTargetNamespace(), decl.getName(), additionalAtts}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); } }
public void attributeUse(XSAttributeUse use) { XSAttributeDecl decl = use.getDecl(); String additionalAtts = ""; if (use.isRequired()) { additionalAtts += " use=\"required\""; } if (use.getFixedValue() != null && use.getDecl().getFixedValue() == null) { additionalAtts += " fixed=\"" + use.getFixedValue() + "\""; } if (use.getDefaultValue() != null && use.getDecl().getDefaultValue() == null) { additionalAtts += " default=\"" + use.getDefaultValue() + "\""; } if (decl.isLocal()) { // this is anonymous attribute use dump(decl, additionalAtts); } else { // reference to a global one String str = MessageFormat.format( "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{ decl.getTargetNamespace(), decl.getName(), additionalAtts}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); } }
public void attributeUse(XSAttributeUse use) { XSAttributeDecl decl = use.getDecl(); String additionalAtts = ""; if (use.isRequired()) { additionalAtts += " use=\"required\""; } if (use.getFixedValue() != null && use.getDecl().getFixedValue() == null) { additionalAtts += " fixed=\"" + use.getFixedValue() + "\""; } if (use.getDefaultValue() != null && use.getDecl().getDefaultValue() == null) { additionalAtts += " default=\"" + use.getDefaultValue() + "\""; } if (decl.isLocal()) { // this is anonymous attribute use dump(decl, additionalAtts); } else { // reference to a global one String str = MessageFormat.format( "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{ decl.getTargetNamespace(), decl.getName(), additionalAtts}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); } }
public void attributeUse(XSAttributeUse use) { XSAttributeDecl decl = use.getDecl(); String additionalAtts = ""; if (use.isRequired()) { additionalAtts += " use=\"required\""; } if (use.getFixedValue() != null && use.getDecl().getFixedValue() == null) { additionalAtts += " fixed=\"" + use.getFixedValue() + "\""; } if (use.getDefaultValue() != null && use.getDecl().getDefaultValue() == null) { additionalAtts += " default=\"" + use.getDefaultValue() + "\""; } if (decl.isLocal()) { // this is anonymous attribute use dump(decl, additionalAtts); } else { // reference to a global one String str = MessageFormat.format( "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{ decl.getTargetNamespace(), decl.getName(), additionalAtts}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); } }
public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) { boolean forConstant = getCustomization(use).isConstantProperty() && use.getFixedValue()!=null; String name = getPropertyName(forConstant); if(name==null) { NameConverter conv = getBuilder().getNameConverter(); if(forConstant) name = conv.toConstantName(use.getDecl().getName()); else name = conv.toPropertyName(use.getDecl().getName()); if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode()) name = JJavaName.getPluralForm(name); } markAsAcknowledged(); constantPropertyErrorCheck(); return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(), BGMBuilder.getName(use.getDecl()), tu, BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use); }
public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) { boolean forConstant = getCustomization(use).isConstantProperty() && use.getFixedValue()!=null; String name = getPropertyName(forConstant); if(name==null) { NameConverter conv = getBuilder().getNameConverter(); if(forConstant) name = conv.toConstantName(use.getDecl().getName()); else name = conv.toPropertyName(use.getDecl().getName()); if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode()) name = JJavaName.getPluralForm(name); } markAsAcknowledged(); constantPropertyErrorCheck(); return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(), BGMBuilder.getName(use.getDecl()), tu, BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use); }
public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) { boolean forConstant = getCustomization(use).isConstantProperty() && use.getFixedValue()!=null; String name = getPropertyName(forConstant); if(name==null) { NameConverter conv = getBuilder().getNameConverter(); if(forConstant) name = conv.toConstantName(use.getDecl().getName()); else name = conv.toPropertyName(use.getDecl().getName()); if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode()) name = JJavaName.getPluralForm(name); } markAsAcknowledged(); constantPropertyErrorCheck(); return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(), BGMBuilder.getName(use.getDecl()), tu, BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use); }
public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) { boolean forConstant = getCustomization(use).isConstantProperty() && use.getFixedValue()!=null; String name = getPropertyName(forConstant); if(name==null) { NameConverter conv = getBuilder().getNameConverter(); if(forConstant) name = conv.toConstantName(use.getDecl().getName()); else name = conv.toPropertyName(use.getDecl().getName()); if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode()) name = JJavaName.getPluralForm(name); } markAsAcknowledged(); constantPropertyErrorCheck(); return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(), BGMBuilder.getName(use.getDecl()), tu, BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use); }
public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) { boolean forConstant = getCustomization(use).isConstantProperty() && use.getFixedValue()!=null; String name = getPropertyName(forConstant); if(name==null) { NameConverter conv = getBuilder().getNameConverter(); if(forConstant) name = conv.toConstantName(use.getDecl().getName()); else name = conv.toPropertyName(use.getDecl().getName()); if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode()) name = JJavaName.getPluralForm(name); } markAsAcknowledged(); constantPropertyErrorCheck(); return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(), BGMBuilder.getName(use.getDecl()), tu, BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use); }