users@jaxb.java.net

Re: Custom mapping for Maps in JAXB

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Fri, 18 Jun 2010 09:14:15 +0200

Ah, that "ON MY OWN" is stating clearly what you'd like to have. My
JAXB Tutorial adresses the topic in this section
<https://jaxb.dev.java.net/tutorial/section_2_2_16_1-Elements-With-Any-Type.html#Elements%20With%20Any%20Type>.


I'ce actually used this technique, either to access "unknown" XML
with the basic techniques, or even a two-level marshalling and
unmarshalling process, when the "inner" structure can not be
included in a generic XML schema defining the outer XML structure.

HTH
-W


On 18 June 2010 08:34, Leo Romanoff <romixlev_at_yahoo.com> wrote:
>
> Hi Wolfgang,
>
> Thanks for your answer! But it is again a bit too generic. Can you provide
a
> bit more JAXB-specific information related to your answer?
>
> I do disagree with you.
>
> As you may know, there are a lot of configuration files for different
> systems written in XML syntax, e.g. Maven and its POM files. In most of
such
> systems, names of the properties (even when they are not known in advance)
> are represented as element names. Values of those properties are then
values
> of these elements. And this works perfectly in many systems.
>
> Also Java, if I'd stop using JAXB, and try to use low-level XML processing
> would allow me to produce any XML that I like. But JAXB + Schema-based
> approach is probably too restrictive.
>
> Therefore, I'm asking how to "break out" of this XML Schema wall for some
> well-defined subsets of my overall objects graph. I'd like the OVERALL
graph
> of JAXB-annotated objects to be still mapped by JAXB and for SPEICIFIC
> SUBSETS I'd like to tell JAXB that I'd do marshalling/unmarshalling ON MY
> OWN. I understand, that I loose Xml schema properties for this subset, but
I
> can live with it and it is still valid Xml fragment.
> Do you see my point?
>
>
>
> Wolfgang Laun-2 wrote:
>>
>> My understanding of XML Schema is that <xs:element>s are static
components
>> of their parent <xs:element>. This maps to Java classes, where elements
>> are
>> represented as fields.
>>
>> Using tags to represent what is actually data (as opposed to field
>> selector)
>> would also cause problems with other XML processors such as XSLT.
>>
>> Feel free to disagree ;-)
>> -W
>>
>
> --
> View this message in context:
http://old.nabble.com/Custom-mapping-for-Maps-in-JAXB-tp28779221p28922379.html
> Sent from the java.net - jaxb users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>