Hi,

I am using xsd2jibx to generate the java classes of my project from an xsd document. But I need to know if next functionality already exists in xsd2jibx.

I would like have in my java classes, for all attributes, a method “hasAttribute” which can tell me if the specify attribute has been informed in the xml document.

 

In my example, attributes “macClass” and “macStage” are type “int” and are optional. In my project, it’s different if the user sends a value “0” in these attributes or if he doesn’t send these attributes (because in this last case, I have to set a default value that is not “0”).

 

 

public class PlanningRequestModelInFactoryMachine {

  protected int rscId;

  protected int macClass;

  protected int macStage;

  protected boolean hasMacClass = false;

  protected boolean hasMacStage = false;

 

  public int getRscId() {

    return this.rscId;

  }

 

  public void setRscId(int rscId) {

    this.rscId = rscId;

  }

 

  public int getMacClass() {

    return this.macClass;

  }

 

  public void setMacClass(int macClass) {

    hasMacClass = true;

    this.macClass = macClass;

  }

 

  public int getMacStage() {

    return this.macStage;

  }

 

  public void setMacStage(int macStage) {

    hasMacStage = true;

    this.macStage = macStage;

  }

}

 

Can you tell me if this functionality already exists or if you can add it in a new version?

 

Regards,

 

Lorelei Tosello

 

Reply via email to