XJC mixed content

View: New views
4 Messages — Rating Filter:   Alert me  

XJC mixed content

by metro-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, I have a simple schema:

  <xs:element name="report">
    <xs:complexType>
      <xs:sequence >    
        <xs:element ref="filter"/>
        <xs:element ref="graphs"/>
...

when I generate Java classes via JAXB it gives me a Report type with members for getting and setting the 'filter' and 'graphs' elements.  All good.
My problem is that I also want to allow character data to appear between the child elements, which should be possible by adding:

  <xs:complexType mixed="true" >

.. but when I add this attribute, the generated Report type no longer has getters/setters for the filter or graphs elements - it just has a single accessor called 'getContent()'.  Is there a way to change the schema to allow mixed content but still have XJC generate the strongly-typed element accessors asit did before adding mixed='true'?

Thanks,
[Message sent by forum member 'blackfrancis' (gfrancis1@...)]

http://forums.java.net/jive/thread.jspa?messageID=370883

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XJC mixed content

by Martin Grebac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
 have a look if this helps:
http://blogs.sun.com/mgrebac/entry/handling_extended_mixed_content_in
 MartiNG

metro@... wrote:

> Hello, I have a simple schema:
>
>   <xs:element name="report">
>     <xs:complexType>
>       <xs:sequence >    
>         <xs:element ref="filter"/>
>         <xs:element ref="graphs"/>
> ...
>
> when I generate Java classes via JAXB it gives me a Report type with members for getting and setting the 'filter' and 'graphs' elements.  All good.
> My problem is that I also want to allow character data to appear between the child elements, which should be possible by adding:
>
>   <xs:complexType mixed="true" >
>
> .. but when I add this attribute, the generated Report type no longer has getters/setters for the filter or graphs elements - it just has a single accessor called 'getContent()'.  Is there a way to change the schema to allow mixed content but still have XJC generate the strongly-typed element accessors asit did before adding mixed='true'?
>
> Thanks,
> [Message sent by forum member 'blackfrancis' (gfrancis1@...)]
>
> http://forums.java.net/jive/thread.jspa?messageID=370883
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>  

--
Martin Grebac, http://blogs.sun.com/mgrebac

Web Technologies & Standards
Sun Microsystems Czech

ICQ: 93478885


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XJC mixed content

by metro-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks - I'll try this out, but I've never used a customization before.  I assume the code is in 2.2EA?
[Message sent by forum member 'blackfrancis' (gfrancis1@...)]

http://forums.java.net/jive/thread.jspa?messageID=370895

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: XJC mixed content

by metro-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmm, using that extension doesn't seem to have made any difference, i.e. I still get just the .getContent() accessor on the Report type.  Maybe I'm using the extension incorrectly?  I have attached my schema if you could please take a look?
[Message sent by forum member 'blackfrancis' (gfrancis1@...)]

http://forums.java.net/jive/thread.jspa?messageID=370897

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...