castor

CastorXML Binding: Configure name of Java-Bean property representing elment content

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.9.5
  • Fix Version/s: 1.1.1
  • Component/s: XML code generator
  • Labels:
    None
  • Environment:
    Operating System: All
    Platform: All
  • Bugzilla Id:
    1310
  • Number of attachments :
    1

Description

All Element content gets mapped to a property 'content' in the
generated classes, i.e. you can access the element's PCDATA
text-content via set/getContent().

I'm looking for a configuration possibility to bind the PCDATA
text-content to something more meaningfull,
like set/getMyElementContent().

Arnaud Blandin replied to a similar request in the castor-dev mailinlist
with the following comment:

>Unfortunately it is not something currently possible with the binding file.
>The binding file only acts on elements that are identified by an XPath
location path.
>It might be included in future releases though.

Activity

Hide
Werner Guttmann added a comment -

Somehow I think that it should be possible to add a 'type expression' to the XPATH statement as expected by an elementBinding instance, along the lines of

/someElementcontent

to uniquely identify the fact that we are looking at the content of the element definition.

Show
Werner Guttmann added a comment - Somehow I think that it should be possible to add a 'type expression' to the XPATH statement as expected by an elementBinding instance, along the lines of /someElementcontent to uniquely identify the fact that we are looking at the content of the element definition.
Hide
Werner Guttmann added a comment -

Initial patch for review. I have added a new <contentMember .../> element to the componentBinding(Type) so that it is possible to override the name and the default visibility of the member generated.

Show
Werner Guttmann added a comment - Initial patch for review. I have added a new <contentMember .../> element to the componentBinding(Type) so that it is possible to override the name and the default visibility of the member generated.
Hide
Werner Guttmann added a comment -

In other words, for a (global) complex type definition 'I1Type' with mixed mode enabled, here's the corresponding element binding:

<elementBinding name="/complexType:I1Type">
<contentMember name="contentMember" />
</elementBinding>

Show
Werner Guttmann added a comment - In other words, for a (global) complex type definition 'I1Type' with mixed mode enabled, here's the corresponding element binding: <elementBinding name="/complexType:I1Type"> <contentMember name="contentMember" /> </elementBinding>

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: