No accessor to text content for element without extension base definition
-------------------------------------------------------------------------

         Key: XMLBEANS-172
         URL: http://issues.apache.org/jira/browse/XMLBEANS-172
     Project: XMLBeans
        Type: Bug
  Components: Compiler  
    Versions: Version 2, Version 2 Beta 1    
 Environment: Observed for schema attached to XMLBEANS-120 
http://issues.apache.org/jira/secure/attachment/12310698/SpaceSystem.xsd with 
XMLBeans 2.0.0-beta1 and 2.0.0 final.
    Reporter: Johannes Stamminger


In the mentioned schema there is defined the type UnitType like:

...
<complexType name="UnitType" mixed="true">
  <annotation>
    <documentation>Used to hold the unit(s) plus possibly the exponents for the 
units</documentation>
  </annotation>
  <attribute name="power" type="decimal" use="optional" default="1"/>
  <attribute name="factor" type="string" default="1"/>
  <attribute name="description" type="string"/>
</complexType>
...

IMHO for an Unit element being of type UnitType it is allowed to set a nested 
text like <Unit>m</Unit> (at least having a document with such a definition is 
validated successfully).
But the XMLBeans generated API does not provide an access to that one, I'm not 
able to set/get the text value from the generated UnitType class as it derives 
from XmlObject.

Only way so far to get accessors (set/getStringValue()) is by changing the 
schema to define the extension base:

...
<complexType name="UnitType" mixed="true">
  <annotation>
    <documentation>Used to hold the unit(s) plus possibly the exponents for the 
units</documentation>
  </annotation>
  <simpleContent>
    <extension base = "string">
      <attribute name="power" type="decimal" use="optional" default="1"/>
      <attribute name="factor" type="string" default="1"/>
      <attribute name="description" type="string"/>
    </extension>
  </simpleContent>
</complexType>
...

That way the UnitType class now derives from XmlString.

Removing the unnecessary (as there are no nested elements defined) mixed="true" 
is not sufficient, still not accessors.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to