< prev index next >

src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Form.java

Print this page




  55         void declare(String attName,Schema schema) {
  56         }
  57     };
  58 
  59     /**
  60      * The same constant defined in the spec.
  61      */
  62     private final XmlNsForm xnf;
  63 
  64     /**
  65      * What's the effective value? UNSET means unqualified per XSD spec.)
  66      */
  67     public final boolean isEffectivelyQualified;
  68 
  69     Form(XmlNsForm xnf, boolean effectivelyQualified) {
  70         this.xnf = xnf;
  71         this.isEffectivelyQualified = effectivelyQualified;
  72     }
  73 
  74     /**
  75      * Writes the attribute on the generated &lt;schema> element.
  76      */
  77     abstract void declare(String attName, Schema schema);
  78 
  79     /**
  80      * Given the effective 'form' value, write (or suppress) the @form attribute
  81      * on the generated XML.
  82      */
  83     public void writeForm(LocalElement e, QName tagName) {
  84         _writeForm(e,tagName);
  85     }
  86 
  87     public void writeForm(LocalAttribute a, QName tagName) {
  88         _writeForm(a,tagName);
  89     }
  90 
  91     private void _writeForm(TypedXmlWriter e, QName tagName) {
  92         boolean qualified = tagName.getNamespaceURI().length()>0;
  93 
  94         if(qualified && this!=QUALIFIED)
  95             e._attribute("form","qualified");


  55         void declare(String attName,Schema schema) {
  56         }
  57     };
  58 
  59     /**
  60      * The same constant defined in the spec.
  61      */
  62     private final XmlNsForm xnf;
  63 
  64     /**
  65      * What's the effective value? UNSET means unqualified per XSD spec.)
  66      */
  67     public final boolean isEffectivelyQualified;
  68 
  69     Form(XmlNsForm xnf, boolean effectivelyQualified) {
  70         this.xnf = xnf;
  71         this.isEffectivelyQualified = effectivelyQualified;
  72     }
  73 
  74     /**
  75      * Writes the attribute on the generated {@code <schema>} element.
  76      */
  77     abstract void declare(String attName, Schema schema);
  78 
  79     /**
  80      * Given the effective 'form' value, write (or suppress) the @form attribute
  81      * on the generated XML.
  82      */
  83     public void writeForm(LocalElement e, QName tagName) {
  84         _writeForm(e,tagName);
  85     }
  86 
  87     public void writeForm(LocalAttribute a, QName tagName) {
  88         _writeForm(a,tagName);
  89     }
  90 
  91     private void _writeForm(TypedXmlWriter e, QName tagName) {
  92         boolean qualified = tagName.getNamespaceURI().length()>0;
  93 
  94         if(qualified && this!=QUALIFIED)
  95             e._attribute("form","qualified");
< prev index next >