[jdom-interest] Use ampersand character in setText

Andrea Pacini pacionet at gmail.com
Fri Dec 16 14:13:34 PST 2011


I am sorry, what I was looking for is :

EntityRef ref = new EntityRef("TrueNorthGuitarsTagline");
ref.setSystemID("tngTagline.xml");

that is the EntityRef.

Sorry again and thanks for your help,

----- Original Message ----- 
From: "Robin Rosenberg" <robin.rosenberg.lists at dewire.com>
To: <jdom-interest at jdom.org>
Sent: Friday, December 16, 2011 5:51 PM
Subject: Re: [jdom-interest] Use ampersand character in setText


> Andrea Pacini skrev 2011-12-16 10.43:
>> Hi,
>> according to Jdom FAQ ( http://www.jdom.org/docs/faq.html#a0290 ) , I 
>> tried to write the string
>>
>> &test
>>
>> using this statement:
>>
>> root.setText("\u0026test");
>>
>> where \u0026 is the Unicode code for ampersand character.
>>
>> The output is:
>>
>> &test
>>
>> Where is the error ?
>
> It's in your interpretation/the writing in the FAQ.
>
> It should be more like "Why does setText(" ") not output a NO-BREAK 
> SPACE
> character into the XML document".
>
> There is no difference in Java between "&test" and "\u0026test", except 
> that the
> latter is harder to read. Both translates into the exact same bytecode.
>
> The FAQ could be complemented with the corrected call, e.g. 
> setText("\u00a0"); To make
> things more confusing Java uses hexadecimal code units while XML uses 
> decimal code points.
>
> -- robin
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com 



More information about the jdom-interest mailing list