On 12 May 2011 09:44, Markus Karg <karg_at_quipsy.de> wrote:
> Are you sure that it is just an abbreviation? I mean, AFAIK <x/> implies
> *no* empty text() node, while <x><x/> does.
>
This distinction depends on the presence of some type information, e.g., XML
Schema: If the element is defined to have some element content and this
content is absent and if the element's @nillable is "true", then the absence
of the content may be indicated by xsi:nil="true".
In Java, all objects have a type; hence, all JAXBElements have a content;
therefore the absence must be indicated by xsi:nil.
Raw XML has no types. Tehrefore, there can't be a difference between "no
character" and "no character".
> How to differenciate between String == null and String.isEmpty() then?
>
By using xsi:nil="true".
As a last resort: it should be possible to produce arbitrary elements by
creating a class implementing java.w3c.dom.Element and inserting this in the
object tree for a property declared as java.lang.Object. See
http://jaxb.java.net/tutorial/section_2_2_16_1-Elements-With-Any-Type.html
>
>
> *From:* Wolfgang Laun [mailto:wolfgang.laun_at_gmail.com]
> *Sent:* Donnerstag, 12. Mai 2011 09:41
> *To:* users_at_jaxb.java.net
> *Subject:* Re: How to prevent xsi:nil="true" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>
>
>
>
> On 12 May 2011 09:27, Wolfgang Laun <wolfgang.laun_at_gmail.com> wrote:
>
> <x></x> is just an abbreviation for <x/>.
>
>
> It's the other way round, of course ;-)
>
>
>
>