You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Radu Preotiuc-Pietro (JIRA)" <xm...@xml.apache.org> on 2008/12/10 02:56:44 UTC

[jira] Resolved: (XMLBEANS-172) No accessor to text content for element without extension base definition

     [ https://issues.apache.org/jira/browse/XMLBEANS-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Radu Preotiuc-Pietro resolved XMLBEANS-172.
-------------------------------------------

    Resolution: Fixed

To keep the rules simple:

- for all complex types with mixed complex content, no accessor methods are generated and we expect the user to use XmlCursor to set the content (this would be required anyway if there are elements also present): myObject.newCursor().setTextValue() doesn't seem too onerous to use

- for complex types with simple content, the accesor method corresponding to the "first" base simple type is generated.


> No accessor to text content for element without extension base definition
> -------------------------------------------------------------------------
>
>                 Key: XMLBEANS-172
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-172
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: Version 2 Beta 1, Version 2
>         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
>            Assignee: Radu Preotiuc-Pietro
>
> 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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org